note 82241 added to language.constants.predefined

From: Date: Wed, 02 Apr 2008 09:13:25 +0000
Subject: note 82241 added to language.constants.predefined
Groups: php.notes 
Request: Send a blank email to php-notes+get-137851@lists.php.net to get a copy of this message
It seems that the Magic constants 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: 89.190.194.18 Probable Submitter: 213.145.98.61 ---- Manual Page -- http://www.php.net/manual/en/language.constants.predefined.php Edit -- https://master.php.net/note/edit/82241 Del: integrated -- https://master.php.net/note/delete/82241/integrated Del: useless -- https://master.php.net/note/delete/82241/useless Del: bad code -- https://master.php.net/note/delete/82241/bad+code Del: spam -- https://master.php.net/note/delete/82241/spam Del: non-english -- https://master.php.net/note/delete/82241/non-english Del: in docs -- https://master.php.net/note/delete/82241/in+docs Del: other reasons-- https://master.php.net/note/delete/82241 Reject -- https://master.php.net/note/reject/82241 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137851) next »