PHP 7
'sClosure::call()
has better performance. Its function is to dynamically bind aclosure function to a new one.
Object instanceAnd call and execute the function.
Description:
public mixed Closure::call ( object $newthis [, mixed $... ] )
newthisand calls it with any given arguments.
Example before php7:
x; }; // 闭包函数绑定到类 A 上 $getX = $getXCB->bindTo(new A, 'A'); echo $getX(); print(PHP_EOL);
Example after php7:
x; }; echo $getX->call(new A); ?>
php video tutorialphp7 tutorial
The above is the detailed content of Example of using Closure::call in PHP7. For more information, please follow other related articles on the PHP Chinese website!