note 84049 deleted from language.constants.predefined by danbrown
| From: | danbrown@php.net | Date: | Wed, 25 Jun 2008 15:59:57 +0000 |
| Subject: | note 84049 deleted from language.constants.predefined by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140811@lists.php.net to get a copy of this message | ||
Note Submitter: me at jamessocol dot com
Reason: useless
----
Michael, David, and Ivan,
__FUNCTION__ doesn't return anything in the eval'd code because it isn't in a
function.
<?php
function eval_test_outer ()
{
echo "Outer function name: ".__FUNCTION__."\n";
eval('function eval_test_inner(){echo "Inner function name:
".__FUNCTION__."\n";} eval_test_inner();');
}
eval_test_outer();
// Outer function name: eval_test_outer
// Inner function name: eval_test_inner
?>
Works exactly as expected. (As of 5.2.5, at least.)
If you want the outer function, you need to do what Michael suggests.