国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP Closure::call()

PHP 7's Closure::call() has better performance, dynamically binding a closure function to a new object instance and calling the function.

Example

<?php
class A {
    private $x = 1;
}

// PHP 7 之前版本定義閉包函數(shù)代碼
$getXCB = function() {
    return $this->x;
};

// 閉包函數(shù)綁定到類 A 上
$getX = $getXCB->bindTo(new A, 'A'); 

echo $getX();
echo "<br/>";

// PHP 7+ 代碼
$getX = function() {
    return $this->x;
};
echo $getX->call(new A);
?>

The above program execution output result is:

1
1
Continuing Learning
||
<?php class A { private $x = 1; } // PHP 7 之前版本定義閉包函數(shù)代碼 $getXCB = function() { return $this->x; }; // 閉包函數(shù)綁定到類 A 上 $getX = $getXCB->bindTo(new A, 'A'); echo $getX(); echo "<br/>"; // PHP 7+ 代碼 $getX = function() { return $this->x; }; echo $getX->call(new A); ?>
submitReset Code