Re: re another hand wringer

From: Date: Mon, 19 Feb 2007 01:52:43 +0000
Subject: Re: re another hand wringer
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-249061@lists.php.net to get a copy of this message
jekillen wrote: > for($i = 0; $i < $flen; $i++) // now it works > { > array_push($edata, $_POST["a_$z"]); > print $_POST["a_$z"].'<br>'; // prints all values. > $z++; > }; I recommend you consider changing your loop to: for ($i = 1; $i <= $flen; $i++) { array_push($edata, $_POST["a_$i"]); print $_POST["a_$i"] . "<br />\n"; } There is no need whatsoever for a $z variable. It's just a waste of memory (albeit a little bit of memory, but why?). :) You're already iterating a loop, why not use the loop counter for your index? It'll make the code more readable too.

« previous php.general (#249061) next »