note 21976 modified in function.eval by didou
| From: | didou@php.net | Date: | Sat, 17 May 2003 14:39:06 +0000 |
| Subject: | note 21976 modified in function.eval by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48144@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.
--was--
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