note 81389 added to language.functions
| From: | JakobThomsen at osu1 dot php dot net | Date: | Tue, 26 Feb 2008 08:57:57 +0000 |
| Subject: | note 81389 added to language.functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136488@lists.php.net to get a copy of this message | ||
Note that if you have the name of function in a variable, then you can call it, if that function is
globally available. It cannot be the name of a function in a class.
An example:
class foo {
public static function bar(){
return "bar in a class called";
}
}
function bar() {
return "normal bar called";
}
$strFN = "bar";
echo $strFN();
$strFN2 = "foo::bar";
echo $strFN2();
This will result in
normal bar called
Fatal error: Call to undefined function foo::bar() in /path/to/test.php on line 16
----
Server IP: 64.71.164.2
Probable Submitter: 128.208.3.29
----
Manual Page -- http://www.php.net/manual/en/language.functions.php
Edit -- https://master.php.net/note/edit/81389
Del: integrated -- https://master.php.net/note/delete/81389/integrated
Del: useless -- https://master.php.net/note/delete/81389/useless
Del: bad code -- https://master.php.net/note/delete/81389/bad+code
Del: spam -- https://master.php.net/note/delete/81389/spam
Del: non-english -- https://master.php.net/note/delete/81389/non-english
Del: in docs -- https://master.php.net/note/delete/81389/in+docs
Del: other reasons-- https://master.php.net/note/delete/81389
Reject -- https://master.php.net/note/reject/81389
Search -- https://master.php.net/manage/user-notes.php