Static Keyword in PHP

Declaring class properties or methods as static makes them accessible without needing an instantiation of the class. A property declared as static , then it can not be accessed with an instantiated class object (though a static method can).

static
<?php

class TestClass
{
public static $my_static = ‘Test01’;

public function normalFunction() {
echo self::$my_static.” is printed through normalFunction()”;
}

public static function staticFunction() {
echo self::$my_static.” is printed through staticFunction()”;
}

}

echo TestClass::$my_static;
echo “< br/ >”;

echo TestClass::staticFunction();
echo “< br/ >”;

$a = new TestClass();
$a::normalFunction();

?>

OUTPUT :
Test01
Test01 is printed through staticFunction()
Test01 is printed through normalFunction()