1
0
mirror of https://github.com/php/php-src.git synced 2026-03-27 01:32:22 +01:00
Files
archived-php-src/tests/classes/__set__get_004.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

38 lines
463 B
PHP

--TEST--
ZE2 __set() and __get()
--FILE--
<?php
class Test {
protected $x;
function __get($name) {
if (isset($this->x[$name])) {
return $this->x[$name];
}
else
{
return NULL;
}
}
function __set($name, $val) {
$this->x[$name] = $val;
}
}
$foo = new Test();
$bar = new Test();
$bar->baz = "Check";
$foo->bar = $bar;
var_dump($bar->baz);
var_dump($foo->bar->baz);
?>
===DONE===
--EXPECT--
string(5) "Check"
string(5) "Check"
===DONE===