Jump to content

Can you assign while to a var?


flamerail

Recommended Posts

I don't know why you'd really want to do that, however, any PHP can be assigned to a variable and executed at run time using eval().

[a href=\"http://us2.php.net/manual/en/function.eval.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.eval.php[/a]

I'll report the chat being down. Thanks.
[!--quoteo(post=375613:date=May 20 2006, 09:01 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 20 2006, 09:01 PM) [snapback]375613[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I don't know why you'd really want to do that, however, any PHP can be assigned to a variable and executed at run time using eval().

[a href=\"http://us2.php.net/manual/en/function.eval.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.eval.php[/a]

I'll report the chat being down. Thanks.
[/quote]

That isnt doing quiet what I needed but thanks.
Why don't you put the code to generate the table into a function. Then you can call the function when you are ready to use the code in it.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]
oh wait, i get it. so you want to do something like this:

[code]
$x = 0;

$blah = "<table>";
while ($x < 10) {
   $blah.= "<tr><td>" . $x . "</td></tr>";
   $x++;
}

$blah.="</table>";

echo $blah;
[/code]
$blah is a string that holds the entire table and contents.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.