note 16872 deleted from function.eval by didou

From: Date: Thu, 11 Dec 2003 12:12:14 +0000
Subject: note 16872 deleted from function.eval by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-61796@lists.php.net to get a copy of this message
Note Submitter: adamhooper@videotron.ca ---- If you are getting a parse error with eval() and have a string like this: $test = 'success'; $string = 'This is a "$test"'; You'll have to add slashes, do the eval() and then remove the slashes, like so: $test = 'success'; $string = 'This is a "$test"'; echo $string; $string = addslashes($string); eval("\$string = \"$string\";"); $string = stripslashes($string); echo $string; Hope this helps someone -- I know it would have helped me :)

« previous php.notes (#61796) next »