| Method to create a public static method with example in PHP?
Static method is one of a member of a class which is called directly by using the class name without creating any instance of class. And in PHP we create a static method by using static keyword. Below is the syntax or code to create a static method:-
class X
{
public static function testHello()
{
echo 'hello Static method';
}
}
X::testHello();
| | |