note 8545 deleted from Variable Functions by torben

From: Date: Sat, 16 Sep 2000 12:48:22 +0000
Subject: note 8545 deleted from Variable Functions by torben
Groups: php.notes 
Request: Send a blank email to php-notes+get-5107@lists.php.net to get a copy of this message
Joe, By renaming your variables $ss[1], $ss[2], ... , $ss[n] you will recieve an array $ss. You can then loop through them like so: <? reset $ss; //Reset the variable so you can loop through it with each. while ($r = each($ss)) { $keyname=$r[0]; //This will be 1, 2, ..., n $value=$r[1]; //This will be its respective value. } ?> > I have a form submit n variables of the form > $ss_1, $ss_2, ... , $ss_n . I now want to write a > while loop that can go through and access > each of these variables sequentially, but > php > won't recognize $ss_$i as a variable or > $"ss_$i" as a variable where $i is the number of > times through the while loop. Does anyone > know how to get around this? This is still a problem when trying to access the complete HTTP headers, which get bundled up as HTTP_Header-Name. I don't know of any way to get a listing of all variables in memory. There should be a root array object which contains all the variables currently in memory. --Cedric Shock

« previous php.notes (#5107) next »