Static Method¶
Static methods are methods defined with the static keyword. They have to be called with the name of the class, rather than instantiated object.
<?php
class x {
static function foo() {
echo __METHOD__;
}
}
//displays x::foo
x::foo();
?>
See also When to use static methods and When Should You (And Shouldn’t You) Use Static Methods in Laravel/PHP? A Practical Guide.
Related : Method, Named Constructors, Scope Resolution Operator ::, Static Class, Static Property, Testable