Why in PHP you can access static method via instance of some class but not only via type name?
UPDATE: I\'m .net developer but i work with php developers too. Recent
In PHP, while you're allowed to access the static method by referencing an instance of the class, you don't necessarily need to do so. For example, here is a class with a static function:
class MyClass{
public static function MyFunction($param){
$mynumber=param*2;
return $mynumber;
}
You can access the static method just by the type name like this, but in this case you have to use the double colon (::), instead of "->".
$result= MyClass::MyFunction(2);
(Please note you can also access the static method via an instance of the class as well using "-->"). For more information: http://php.net/manual/en/language.oop5.static.php