3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Data implements ArrayAccess { public $namespaceScopes = []; // make private public function offsetExists(string $namespace) : boolean { return isset($this->namespaceScope[$namespace]); } public function offsetGet(string $namespace) : NamespaceScope { return $this->namespaceScopes[$namespace]; } public function offsetSet(string $namespace, NamespaceScope $namespaceScope) { $this->namespaceScopes[$namespace] = $namespaceScope; } public function offsetUnset(string $namespace) { unset($this->namespaceScopes[$namespace]); } }
based on TKImF
Output for 7.0.0 - 7.2.0
Fatal error: Declaration of Data::offsetExists(string $namespace): boolean must be compatible with ArrayAccess::offsetExists($offset) in /in/X5rn3 on line 3
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/X5rn3 on line 7
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/X5rn3 on line 5
Process exited with code 255.