PHP OOP - Static Methods
PHP - Static Methods
Without creating an instance of the class first is static method.
Static methods are declared with the static keyword:
Syntax
<?php
class ClassName {
public static function staticMethod() {
echo "Welcome To Tutorial Codeplay!";
}
}
?>
To access a static method use the class name, double colon (::), and the method name.
Syntax
ClassName::staticMethod();