<title>class: __isset</title>

<php out='stdout' compile='true'>
<?

class SomeClass
{
	private static $arr = array();
	private $o1;
	private $o2;
	private $o3;

	public function __construct()
	{
		echo "calling constructor\n\n";
		self::$arr["o1"] = "test1";
		self::$arr["o2"] = "test2";
		self::$arr["o3"] = "test3";

	}


	public function __get($name)
	{
		echo "calling __get($name) \n";
		return self::$arr["$name"];
	}

	public function __isset($name)
	{
		echo "name is $name \n";
		if($name == "test")
			return true;

		if($name == "foo")
			return true;

		return false;

	}

}

$o = new SomeClass();


$validNames = array("test", "foo");
$invalidNames = array("bar", "baz");

foreach($validNames as $name)
{
	echo (assert( isset($o->{$name}) === true) ? "OK" : "FAIL" ) . "\n"; 
}

foreach($invalidNames as $name)
{
	echo (assert( isset($o->{$name}) === false) ? "OK" : "FAIL") . "\n"; 
}

echo "\n";

echo "o1: " . $o->o1 . "\n";
echo "o2: " . $o->o2 . "\n";
echo "o3: " . $o->o3 . "\n";

?>
</php>

<compare file='stdout'>
calling constructor

name is test 
OK
name is foo 
OK
name is bar 
OK
name is baz 
OK

calling __get(o1) 
o1: test1
calling __get(o2) 
o2: test2
calling __get(o3) 
o3: test3
</compare>
