1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 10:43:30 +02:00
Files
archived-php-src/Zend/tests/closure_call.phpt
T
2014-07-30 01:26:53 +01:00

48 lines
592 B
PHP

--TEST--
Closure::call
--FILE--
<?php
class Foo {
public $x = 0;
function bar() {
return function () {
return $this->x;
};
}
}
$foo = new Foo;
$qux = $foo->bar();
$foobar = new Foo;
$foobar->x = 3;
var_dump($qux());
var_dump($qux->call($foo));
var_dump($qux->call($foobar));
$bar = function () {
return $this->x;
};
$elePHPant = new StdClass;
$elePHPant->x = 7;
var_dump($bar->call($elePHPant));
$beta = function ($z) {
return $this->x * $z;
};
var_dump($beta->call($elePHPant, 3));
?>
--EXPECT--
int(0)
int(0)
int(3)
int(7)
int(21)