Executing statments in a string
by raja[ Edit ] 2009-10-01 10:23:47
To execute php code in a string,one can use eval() function.
For example,
<?php
$str = "\$x=5*log(10);";
eval($str);
echo $x;
?>
Here the $x will have the result of the expression 5*log(10).