note 82240 added to function.eval

From: Date: Wed, 02 Apr 2008 09:09:58 +0000
Subject: note 82240 added to function.eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-137850@lists.php.net to get a copy of this message
It seems that the Magic constants (http://www.php.net/manual/en/language.constants.predefined.php) do NOT work in an eval()'ed code. Probably because PHP substitutes these statically when it compiles the source code of your PHP script initially. So the following will not work as expected: <?php function user_func1() { echo "User function name: ".__FUNCTION__."\n"; eval('echo "in eval(): User function name: ".__FUNCTION__."\n";'); } ?> Calling user_func1() will output: User function name: user_func1 User function name: ---- Server IP: 217.75.128.29 Probable Submitter: 213.145.98.61 ---- Manual Page -- http://www.php.net/manual/en/function.eval.php Edit -- https://master.php.net/note/edit/82240 Del: integrated -- https://master.php.net/note/delete/82240/integrated Del: useless -- https://master.php.net/note/delete/82240/useless Del: bad code -- https://master.php.net/note/delete/82240/bad+code Del: spam -- https://master.php.net/note/delete/82240/spam Del: non-english -- https://master.php.net/note/delete/82240/non-english Del: in docs -- https://master.php.net/note/delete/82240/in+docs Del: other reasons-- https://master.php.net/note/delete/82240 Reject -- https://master.php.net/note/reject/82240 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137850) next »