Static Properties in PHP
You can call static properties directly, without making a new instance of a class.
The static keyword is used to declare properties that don\’t change:
Syntax
<?php
class Class_Name {
public static $variable = \”Coderazza.com\”;
}
?>
Use the class name, a double colon (::), and the property name to get to a static property:
Syntax
Class_Name::$variable ;
Example
<!DOCTYPE html>
<html>
<body><?php
class rad {
public static $result = 8.9876654321;
}// Get static property
echo rad::$result;
?></body>
</html>
Output
8.9876654321