note 109182 added to language.functions

From: Date: Tue, 26 Jun 2012 14:45:52 +0000
Subject: note 109182 added to language.functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-188862@lists.php.net to get a copy of this message
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 :) ---- Server IP: 69.147.83.197 Probable Submitter: 90.152.3.162 ---- Manual Page -- http://www.php.net/manual/en/language.functions.php Edit -- https://master.php.net/note/edit/109182 Del: integrated -- https://master.php.net/note/delete/109182/integrated Del: useless -- https://master.php.net/note/delete/109182/useless Del: bad code -- https://master.php.net/note/delete/109182/bad+code Del: spam -- https://master.php.net/note/delete/109182/spam Del: non-english -- https://master.php.net/note/delete/109182/non-english Del: in docs -- https://master.php.net/note/delete/109182/in+docs Del: other reasons-- https://master.php.net/note/delete/109182 Reject -- https://master.php.net/note/reject/109182 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188862) next »