Web Development
 
Your Ad Here
PHP Dynamic Variables 
Simple PHP code of the day....

Example Scenario: Let's say you have multiple loops coming out of the database, and you are adding "checked" to specific checkboxes.

Normally you could just do something like this:

$temp = "myVarName".$i;
$$temp = "checked";

But now let's say you have multiple loops breaking out in your <tr>...
Scary stuff people...

How would you echo $$temp ?
HINT: <?php echo $$temp; ?> will not work in this scenario...

hmm give up?

Here's your Answer:

${"myVarName".$i}

And that's the Simple PHP code of the day...


[ add comment ] ( 8 views )   |  permalink  |   ( 3 / 191 )

<<First <Back | 1 | 2 | 3 | 4 | Next> Last>>


Home | Portfolio | Hosting | Web Development | Contact Us
© 2007 dpwebservices.net. All right reserved.