3v4l.org

run code in 300+ PHP versions simultaneously
<?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']));

preferences:
44.11 ms | 402 KiB | 5 Q