3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class CaseInsensitiveArray extends ArrayObject { public function offsetExists($index) { return parent::offsetExists(strtolower($index)); } public function offsetGet($index) { return parent::offsetGet(strtolower($index)); } public function offsetSet($index, $newval) { parent::offsetSet(strtolower($index), $newval); } } $test = new CaseInsensitiveArray; $test['Location'] = 'test'; ini_set('error_reporting', E_ALL); var_dump($test['location']); var_dump($test['Location']); var_dump(isset($test['location'])); var_dump(isset($test['Location']));
Output for 5.0.4 - 7.1.0
string(4) "test" string(4) "test" bool(true) bool(true)
Output for 5.0.0 - 5.0.3
Notice: Undefined index: location in /in/i0rbp on line 26 NULL string(4) "test" bool(false) bool(true)
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/i0rbp on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/i0rbp on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/i0rbp on line 7
Process exited with code 255.