class MyClass { public static $count = 0; public function __construct() { self::$count++; } }
class Math { public static function add($a, $b) { return $a + $b; } }In this example, we declare a static function called add() in the Math class. We can call this function using the class name itself, like Math::add(2, 3). These examples use core PHP functionality and do not require any package or library dependencies.