phat_hip_prog Posted March 26, 2007 Share Posted March 26, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.