On Saturday 30 March 2002 12:39, Jonathan Duncan wrote: > Yeah, I have played with the eval function a bit, but it didn't seem to > help much. Then again, I haven't ever used the eval function before so I > may not know how to properly implement it. I have read the page for eval > on php.net several times as well as the very helpful examples, but whenever > I use eval, it just prints out the same stuff. By same stuff I mean wether > I use eval or just the variable by itself it just prints out the contents > of the variable. In the web page source it looks as if the contents were > merely echoed because it still has the $'s and variable names. Any other > ideas or examples on how to implement eval on this?
Well one thing you shouldn't do is use double-quotes when assigning strings for later evaluation, particularly when they contain 'variables'. Thus this does NOT work: <?php $doo = "$doo = 'dah';"; # $ eval($doo); echo "Doo is $doo<br>"; ?> Whereas this does: <?php $doo = '$doo = \'dah\';'; eval($doo); echo "Doo is $doo<br>"; ?> -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* To program is to be. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php