note 70409 added to function.eval

From: Date: Sun, 15 Oct 2006 18:07:22 +0000
Subject: note 70409 added to function.eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-118549@lists.php.net to get a copy of this message
This is a variation on the contribution of Matt's note, to load a php file into a variable and then evaluate it (which works perfect). This snippet does almost te same, but instead of sending it back to the browser, it sends it back to a variable. <?PHP function phpWrapper($content) { ob_start(); $content = str_replace('<'.'?php','<'.'?',$content); eval('?'.'>'.trim($content).'<'.'?'); $content = ob_get_contents(); ob_end_clean(); return $content; } $content = file_get_contents('feedback.php'); $content = phpWrapper($content); // $content will now contain your evaluated code :) ?> ---- Server IP: 194.109.193.119 Probable Submitter: 145.99.207.250 ---- Manual Page -- http://www.php.net/manual/en/function.eval.php Edit -- https://master.php.net/note/edit/70409 Del: integrated -- https://master.php.net/note/delete/70409/integrated Del: useless -- https://master.php.net/note/delete/70409/useless Del: bad code -- https://master.php.net/note/delete/70409/bad+code Del: spam -- https://master.php.net/note/delete/70409/spam Del: non-english -- https://master.php.net/note/delete/70409/non-english Del: in docs -- https://master.php.net/note/delete/70409/in+docs Del: other reasons-- https://master.php.net/note/delete/70409 Reject -- https://master.php.net/note/reject/70409 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#118549) next »