class Math{ const PI = 3.14; public static function rangeArea(float $r) : float{ // in the body of the static method to access the constant use self::name return $r * $r * self::PI; } public static function rangeLength(float $r) : float{ return 2 * $r * self::PI; } }
We can resort to the static method without creating a class object
echo Math::rangeArea(5) echo Math::rangeLength(5)
self:: use for early static binding there is also late static binding to get it use static::

Early and Late static binding in PHP. Code example
June 15, 2022