Jump to content

eval


phat_hip_prog

Recommended Posts

Hi,

I have a store of strings (db, file, var) that contain a mixture of php and html. These I want to evaluate, outputting the result to a string for later inclusion in the printed page...

 

oops, solved it?

 

<?php
$s = "<h1>TESTING</h1><?php print \"test\$x<br>\"; ?>ENDING TESTS<br>";

$x = "ing...";

function evaluate_01($s)
{
global $x;
ob_start();
$x = eval("?>".$s);
$l = ob_get_contents();
ob_end_clean();
return $l;
}
$l = evaluate_01($s);
print $l;
print "</body></html>";
?>

 

any comments, improvements, handling?

Link to comment
https://forums.phpfreaks.com/topic/44364-eval/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.