frozenade
01-09-2008, 03:52 PM
Hello.
About these eval, which one would run faster ?
function wrapper($content) {
ob_start();
$content = str_replace('<'.'?php','<'.'?',$content);
eval('?'.'>'.trim($content).'<'.'?');
$content = ob_get_contents();
ob_end_clean();
return $content;
}
$content = file_get_contents('somefile.php');
$content = wrapper($content);
echo $content;
or
$content = file_get_contents('somefile.php');
$content = "?>" . $content;
eval($content);
I get confuse which one should I take in correct way.
About these eval, which one would run faster ?
function wrapper($content) {
ob_start();
$content = str_replace('<'.'?php','<'.'?',$content);
eval('?'.'>'.trim($content).'<'.'?');
$content = ob_get_contents();
ob_end_clean();
return $content;
}
$content = file_get_contents('somefile.php');
$content = wrapper($content);
echo $content;
or
$content = file_get_contents('somefile.php');
$content = "?>" . $content;
eval($content);
I get confuse which one should I take in correct way.