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 Quote 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(); Quote 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 Quote 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. Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/182011-php-function/#findComment-960103 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.