note 62265 deleted from function.eval by danbrown

From: Date: Sun, 17 May 2009 19:57:29 +0000
Subject: note 62265 deleted from function.eval by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155300@lists.php.net to get a copy of this message
Note Submitter: apmuthu at usa dot net ---- 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.

« previous php.notes (#155300) next »