Re: re another hand wringer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux