is there any performance difference ? whats the main difference anyway ?
and there is more like
public static function
static public function
is it the same ?
sorry for a newbie question
thanks for looking in
Adam Ramadhan
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no difference in the two :
Both a accessible outside of the class. In both, you can’t use $this inside the function because a static function does not requiere an object to be instanciated.
Consider you have a Cars class.
This way a class can take care of all instances of it there is (and a reference to each). And things that should be handle by the class itself and do not requiere an instance to be created.