mrneilrobinson Posted November 18, 2009 Share Posted November 18, 2009 hi there, ive been asked to call the function 'bar' from the following code, but not sure how to do this? class Foo { public static function bar() { } } kind regards neil robinson Link to comment https://forums.phpfreaks.com/topic/182011-php-function/ Share on other sites More sharing options...
JustLikeIcarus Posted November 18, 2009 Share Posted November 18, 2009 Foo::bar(); Link to comment https://forums.phpfreaks.com/topic/182011-php-function/#findComment-960058 Share on other sites More sharing options...
mrneilrobinson Posted November 18, 2009 Author Share Posted November 18, 2009 do i use two colons as you wrote? apologies, im a bit of a novice Link to comment https://forums.phpfreaks.com/topic/182011-php-function/#findComment-960062 Share on other sites More sharing options...
abazoskib Posted November 18, 2009 Share Posted November 18, 2009 it's correct as written above...try it next time instead of asking and waiting for an answer. Link to comment https://forums.phpfreaks.com/topic/182011-php-function/#findComment-960086 Share on other sites More sharing options...
mikesta707 Posted November 18, 2009 Share Posted November 18, 2009 Please note you can only use the quantifier with static functions and attributes. the following would not work class foo { public function bar() {} } foo::bar();//throws an error Link to comment https://forums.phpfreaks.com/topic/182011-php-function/#findComment-960103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.