June 2017
Intermediate to advanced
536 pages
9h 49m
English
The __callStatic() magic is nearly identical to the __call() method. Where the __call() method is bound to the object context, the __callStatic() method is bound to the static context, which means this method is triggered when invoking inaccessible methods via the scope resolution operator (::).
The method accepts two parameters as per the following synopsis:
public static mixed __callStatic (string $name, array $arguments)
Notice the use of the static access modifier in the method declaration that is required by the static context upon which this method operates. The following example demonstrates the use of the __callStatic() method in the static context:
<?phpclass User{ public static function __callStatic($name, ...