class Example { public static $name = 'John'; public static function sayHello() { echo "Hello, I am " . self::$name; } } $name = Example::$name; Example::sayHello();
namespace MyPackage; class Math { public static function add($a, $b) { return $a + $b; } } $result = \MyPackage\Math::get_static('add', array(2, 3));In this example, we define a static method `add()` in the `Math` class inside the `MyPackage` namespace. We then use the `get_static()` method to call the `add()` method with the parameters `2` and `3`. The package library for this example is likely to be `MyPackage`.