Rasi
answered Nov 30 '-1 00:00
eval function run the given PHP code , you can do same by including that code like this by include file
function runEval($code){
file_put_contents("temp.php", $code);
ob_start();
include("temp.php");
$data=ob_get_contents();
ob_end_clean();
return $data;
}
runEval('echo "hello";');
it will print hello
because we copied code to a temp file and made it to include and buffered to output it.
so we made dummy eval function which is safe and sound we can put filter before code run.
so we made alternative of eval function .but it is not quite impressive as eval itself in PHP