you can create variables dinamically like that
foreach ($some_arr as $key=>$value){
    $("your_dyn_var".$counter}="some html code";

So if you have 5 iterations you will have in the namespace new 5 variables : from 
$your_dyn_var0 to $your_dyn_var4

When you want to show them in the parsed html do:
while(isset(${"your_dyn_var".$counter++})) echo ${"your_dyn_var".($counter-1);}
for ($tmp_count=0;$tmp_count<$counter;$counter++){ echo ${"your_dyn_var".$counter"};}

Best regards
Andrey Hristov

----- Original Message -----
From: Honey House Designs
Sent: Thursday, February 14, 2002 7:56 PM
Subject: [PHP-DEV] Newbie help w/ dynamic variables

I would like to dynamically create variables in my WHILE loop that then can actually 
have php parsed html code stored inside them
and then have the value of that variable run when after php is run and as the html is 
evaluated at page loading...

Any suggestions? And be gentle... I am a newbie!
Tx, tb

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to