Re: submission of 1..N variables

From: Date: Mon, 19 Mar 2001 14:19:49 +0000
Subject: Re: submission of 1..N variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-44575@lists.php.net to get a copy of this message
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@mediawaveonline.com "Ekkard Gerlach" <mlp_gerlach@nikocity.de> wrote in message news:3AB54F48.BCED62FC@nikocity.de... 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@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#44575) next »