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, When Should You (And Shouldn’t You) Use Static Methods in Laravel/PHP? A Practical Guide and Static Methods in PHP: Practical Patterns, Pitfalls, and Production Guidance (2026).
Related : Method, Named Constructors, Scope Resolution Operator ::, Static Class, Static Property, Testable