forward_static_call
Description
The forward_static_call of Function Handling for PHP call a static method.
Syntax
forward_static_call ( callable $function [, mixed $... ] ) : mixed
Parameters
function
The function or method to be called. This parameter may be an array, with the name of the class, and the method, or a string, with a function name.
...
Zero or more parameters to be passed to the function.
Return
Returns the function result, or FALSE on error.
Examples
1
<?
class A
{
const NAME = 'A';
public static function test() {
$args = func_get_args();
echo static::NAME . " " . self::NAME . " " . join(" ", $args) . "\n";
}
}
class B extends A
{
const NAME = 'B';
public static function test() {
$args = func_get_args();
echo static::NAME . " " . self::NAME . " " . join(" ", $args) . "\n";
forward_static_call(array('A', 'test'), 'more', 'args');
forward_static_call('test', 'other', 'args');
}
}
function test() {
$args = func_get_args();
echo "C " . join(" ", $args) . "\n";
}
B::test('some', 'args');
0