Friday, February 21, 2014

PHP oops Static function example



class Person
{
	
	public static function statExample()
	{
	   echo 'Hi static  function. no need to instantiate';
	}
	
}



Person::statExample();

Explanation:

Static functions are function that starts with static keyword.

No need to instantiate static functions

Performance methods implemented as static and
instance would little difference in terms of
performance 

The short answer is that static functions are faster.


No comments:

Post a Comment