Static properties in PHP, can be used directly without creating class object. It can be used with class name only.

Syntax

static variablename;

Creating Static property

static keyword is used before property/variable name.

<?php
class myClass{
   
 public static $number = 20;

}
?>

Accessing static property

Scope resolution operator :: is used to access static property with class name.

<?php
class myClass{
   
  public static $number = 20;

}
// Accessing static property with classname and scope resolution operator
echo myClass::$number;
?>