php-general | 2001032
Date: 03/19/01
- Next message: Chris Lee: "Re: [PHP] Source Protection"
- Previous message: Mario Henrique Cruz Torres: "[PHP] Re: [PHP-DB] Query - Grouping Results"
- In reply to: Ekkard Gerlach: "[PHP] submission of 1..N variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'll show you how you want, but will recommend using arrays.
<?php
$A0 = '0';
$A1 = '1';
$A2 = '2';
$A3 = '3';
if (isset($A1))
{
$i = 0;
$var_name = "A$i";
while(isset($$var_name))
{
// do something
$i++;
$var_name = "A$i";
}
}
?>
heres what you should be doing.
<?php
$A[] = '0';
$A[] = '1';
$A[] = '2';
$A[] = '3';
if (isset($A))
foreach($A as $pos => $val)
// do something
?>
alot simpler, expandible and easier to read. Im sure its probably faster too...
--Chris Lee lee <email protected>
"Ekkard Gerlach" <mlp_gerlach <email protected>> wrote in message news:3AB54F48.BCED62FC <email protected> Hi,
n variables reach my php-programm by submission:
A0 A1 ... An
Depending on Ai is set I want to run some actions.
How can I evaluate Ai ??
if (isset (A1) then # entrance { i=0; while( isset($Ai)) { /* Of course $Ai is not working !!! */ { $B= $Ai ... action ... } }
I tried a lot with eval , with backticks, ... but no suceess.
Anybody an Idea?
tia Ekkard
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Chris Lee: "Re: [PHP] Source Protection"
- Previous message: Mario Henrique Cruz Torres: "[PHP] Re: [PHP-DB] Query - Grouping Results"
- In reply to: Ekkard Gerlach: "[PHP] submission of 1..N variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

