Executing statments in a string - PHP Views : 393
Tagged in : PHP
0 0
Send mail
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).
By raja, On - 2009-10-01



    Login to add Comments .