Public feed #891964

Seldaek

public php v1 · immutable
Raw Edit
·published 2008-02-05 01:10 UTC
rendered paste body
<?php$p = new Test();$p['foo']=1;var_dump($p);class Test implements ArrayAccess{ 	public function offsetExists($offset) 	{ 		return property_exists($this, $offset); 	} 	public function offsetGet($offset) 	{ 		return $this->$offset; 	} 	public function offsetSet($offset, $value) 	{ 		$this->$offset = $value; 	} 	public function offsetUnset($offset) 	{ 		unset($this->$offset); 	}}// => Fatal error: Class 'Test' not found// ---------------------------------------------------class Test implements ArrayAccess{ 	public function offsetExists($offset) 	{ 		return property_exists($this, $offset); 	} 	public function offsetGet($offset) 	{ 		return $this->$offset; 	} 	public function offsetSet($offset, $value) 	{ 		$this->$offset = $value; 	} 	public function offsetUnset($offset) 	{ 		unset($this->$offset); 	}}$p = new Test();$p['foo']=1;var_dump($p);// => object(Test)#1 (1) { ["foo"]=> int(1) } ?>