3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ExtendedArrayAccess implements ArrayAccess { private $data = array(); function __construct(array $array = array()) { $this->data = $array; } function offsetExists($offset) { return array_key_exists($offset, $this->data); } function offsetGet($offset) { return $this->data[$offset]; } function offsetSet($offset, $value) { $this->data[$offset] = $value; } function offsetUnset($offset) { unset($this->data[$offset]); } } $array = new ExtendedArrayAccess(); $array[0] = null; assert(isset($v = &$array[0]) === false); assert(empty($array[0]) === true);
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '=', expecting ',' or ')' in /in/0pANi on line 24
Process exited with code 255.

preferences:
194.53 ms | 1395 KiB | 65 Q