note 21976 added to function.eval

From: Date: Sun, 02 Jun 2002 16:59:27 +0000
Subject: note 21976 added to function.eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-31347@lists.php.net to get a copy of this message
if u have string $s to "translate", coming from a file or database, and u required to email it, use this code: ob_start(); eval("echo \"".addslashes($s)."\";"); $s= ob_get_contents(); ob_end_clean (); $s=stripslashes($s); the orginal content of $s should look like this: hello <b>$GLOBALS[username]</b> the code produce: hello <b>Akuma</b> take care if u put this merge code in a function, eval use same data accessibility as ..."print" function for example. Read details and comments about ob_xxx, very interesting. -- http://www.php.net/manual/en/function.eval.php http://master.php.net/manage/user-notes.php?action=edit+21976 http://master.php.net/manage/user-notes.php?action=delete+21976 http://master.php.net/manage/user-notes.php?action=reject+21976

« previous php.notes (#31347) next »