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']));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of CaseInsensitiveArray::offsetExists($index) should either be compatible with ArrayObject::offsetExists(mixed $key): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/i0rbp on line 7 Deprecated: Return type of CaseInsensitiveArray::offsetGet($index) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/i0rbp on line 12 Deprecated: Return type of CaseInsensitiveArray::offsetSet($index, $newval) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/i0rbp on line 17 string(4) "test" string(4) "test" bool(true) bool(true)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
53.85 ms | 403 KiB | 8 Q