note 62265 added to function.eval
| From: | apmuthu at usa dot net | Date: | Thu, 23 Feb 2006 17:02:21 +0000 |
| Subject: | note 62265 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104311@lists.php.net to get a copy of this message | ||
Ref: Nick - SafireX, TfM, Nick Johnson - Pixelrific
Generic eval function
Replace the line:-
$string = preg_replace("/<\?=\s+(.*?)\s+\?>/", "<? echo $1; ?>",
$string);
with
$string = preg_replace("/<\?=\s*(.*?)\s*\?>/", "<? echo $1; ?>",
$string);
The "\s*" in the two places will enable 0 or more white spaces to exist after the
"=" instead of the existing "\s+" which enables only 1 or more white spaces.
Also instead of using the eval function in the return statement of the function, it would be better
to return only the string ready to perform eval and then do the eval in the main program where the
scope and visibility of variables are known.
----
Server IP: 203.199.124.111
Probable Submitter: 60.254.100.24
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+62265
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62265&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62265&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62265&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62265&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62265&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62265&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62265&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+62265&report=yes
Search -- http://master.php.net/manage/user-notes.php