note 71331 deleted from function.eval by bobby
| From: | bobby@php.net | Date: | Thu, 23 Nov 2006 03:46:04 +0000 |
| Subject: | note 71331 deleted from function.eval by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120004@lists.php.net to get a copy of this message | ||
Note Submitter: php dot net at laurillard dot com
Reason: bad code
----
To my surprise (coming from a Javascript background), the eval()-function did not work as I
expected:
<?php
$username = "patrick";
$tekst = "rname";
eval("echo \$use" . $tekst ); /// error
echo eval("\$use" . $tekst); /// error
echo ${"use" . $tekst}; /// success: returns 'patrick'
?>