note 109182 deleted from language.functions by danbrown
| From: | danbrown@php.net | Date: | Tue, 26 Jun 2012 14:49:29 +0000 |
| Subject: | note 109182 deleted from language.functions by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188863@lists.php.net to get a copy of this message | ||
Note Submitter: info at jqui dot net
----
in response to Jakob Thomsen;
The problem is that you are using the whole string as a function hence why you get a fatal error.
<?php
class foo {
public static function bar(){
return "bar in a class called";
}
}
function bar() {
return "normal bar called";
}
$strFN = "bar";
echo $strFN();
//e.g. The wrong way...
$strFN2 = "foo::bar";// this is wrong,coz, for the same reason you can define
function foo::bar(){...}
echo $strFN2();
// the right way...
$strFN2 = "bar";
echo foo::$strFN2();
?>
Hope that it helps you understand :)