Your IP : 216.73.216.48


Current Path : /hdd/hdd21/main/php/php-7.3.1/tests/classes/
Upload File :
Current File : //hdd/hdd21/main/php/php-7.3.1/tests/classes/__set__get_004.phpt

--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===