Arquivos
hhvm/hphp/test/quick/zend_indirect_method_call_005.php
T
ptarjan 503f75d08b Rename test directories
These names don't make sense now that we run both suites the same
way.
2013-04-17 09:06:51 -07:00

37 linhas
970 B
PHP

<?php
/*
We dont' have ArrayObject so use something from http://php.net/manual/en/class.arrayaccess.php
class foo extends ArrayObject {
public function __construct($arr) {
parent::__construct($arr);
}
}
*/
class foo implements arrayaccess {
private $container = array();
public function __construct($container) {
$this->container = $container;
}
public function offsetSet($offset, $value) {
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
public function offsetExists($offset) {
return isset($this->container[$offset]);
}
public function offsetUnset($offset) {
unset($this->container[$offset]);
}
public function offsetGet($offset) {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
}
var_dump( (new foo( array(1, array(4, 5), 3) ))[1][0] ); // int(4)
?>