A static function is a class function that can be called without creating an object of the class.

A function that can be called without creating object

Static Function:

  • Static methods can be called without instantiating the class.
  • They are also declared using the static keyword.
  • You can access them using the class name followed by ::
<?php
class Demo
{
    public static function hello()
    {
        echo "Hello PHP";
    }
}
Demo::hello();
?>