3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Param extends ArrayObject { public function offsetGet($name) { if (!$this->offsetExists($name)) return null; return parent::offsetGet($name); } } $data = new Param(array('foo' => 12)); var_dump($data['bar'], $data['foo]);
Output for 5.4.0 - 5.4.19, 5.5.0 - 5.5.3
Parse error: syntax error, unexpected ''foo]);' (T_ENCAPSED_AND_WHITESPACE), expecting ']' in /in/76tVc on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /in/76tVc on line 14
Process exited with code 255.

preferences:
175.27 ms | 1399 KiB | 59 Q