This is a discussion on NEED HELP Incrementing a variable name within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi I can't find info on how to achieve the following: I want to increment through the variable names ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi I can't find info on how to achieve the following:
I want to increment through the variable names I've already set. Specifically $general_image1, $general_image2 & $general_image3 I need something like this code (that works !!) for($i=1; $i<4; $i++) { if($general_image[$i] != " ") { blah blah... } } Regs Nitrous |
|
|||
|
Kindly answered by "Peter van Schie" in alt.php
<?php for($i=1; $i<4; $i++) { if (${"general_image".$i} != " ") { // blah blah... } } ?> Cheers Nitrous "Nitrous" <nitrous@congosystems.com> wrote in message news:4390e676$1@dnews.tpgi.com.au... Hi I can't find info on how to achieve the following: I want to increment through the variable names I've already set. Specifically $general_image1, $general_image2 & $general_image3 I need something like this code (that works !!) for($i=1; $i<4; $i++) { if($general_image[$i] != " ") { blah blah... } } Regs Nitrous |