3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo implements \ArrayAccess { private $array_access = ['array_access'], $brace_access = ['brace_access']; public function __get ($offset) { return $this->brace_access[$offset]; } public mixed offsetGet ( $offset ) { return $this->array_access[$offset]; } public offsetExists ( $offset ) {} public offsetSet ( $offset , $value ) {} public offsetUnset ( $offset ) {} } $foo = new Foo; echo $foo{0}; echo $foo[0];
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'mixed' (T_STRING), expecting variable (T_VARIABLE) in /in/iX94Z on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/iX94Z on line 4
Process exited with code 255.