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 )
Calendar


