note 92554 added to functions.anonymous
| From: | tomatrdotje at osu1 dot php dot net | Date: | Wed, 29 Jul 2009 10:51:07 +0000 |
| Subject: | note 92554 added to functions.anonymous | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158864@lists.php.net to get a copy of this message | ||
Unfortunately, you can't get a pointer to a function, the only function pointers are ones which
use anonymous functions as they're created.
This wont work:
<?php
$info = phpinfo;
$info();
//or
function foo() {
echo 'bar';
}
$foo = foo;
$foo();
?>
Because of the behavior of $foo(), it will assume $foo is a string, and try to run the function with
the name stored in the string.
----
Server IP: 87.124.35.190
Probable Submitter: 195.149.46.150
----
Manual Page -- http://www.php.net/manual/en/functions.anonymous.php
Edit -- https://master.php.net/note/edit/92554
Del: integrated -- https://master.php.net/note/delete/92554/integrated
Del: useless -- https://master.php.net/note/delete/92554/useless
Del: bad code -- https://master.php.net/note/delete/92554/bad+code
Del: spam -- https://master.php.net/note/delete/92554/spam
Del: non-english -- https://master.php.net/note/delete/92554/non-english
Del: in docs -- https://master.php.net/note/delete/92554/in+docs
Del: other reasons-- https://master.php.net/note/delete/92554
Reject -- https://master.php.net/note/reject/92554
Search -- https://master.php.net/manage/user-notes.php