3v4l.org

run code in 300+ PHP versions simultaneously
<?php class aa implements ArrayAccess { protected $_data = array(); public function offsetGet($key) { return $this->_data[$key]; } public function offsetSet($key, $value) { $this->_data[$key] = $value; } public function offsetExists($key) { return isset($this->_data[$key]); } public function offsetUnset($key) { unset($this->_data[$key]); } } $a = new aa; $a['name'] = 'Dżozef'; $a['id'] = 5; $b = array(); $b[0] = $a; $b[1] = array( 'name' => 'Kinszasa', 'id' => 17, ); var_dump(array_column($b, null, 'id'));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of aa::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/13sdC on line 15 Deprecated: Return type of aa::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/13sdC on line 7 Deprecated: Return type of aa::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/13sdC on line 11 Deprecated: Return type of aa::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/13sdC on line 19 array(2) { [0]=> object(aa)#1 (1) { ["_data":protected]=> array(2) { ["name"]=> string(7) "Dżozef" ["id"]=> int(5) } } [17]=> array(2) { ["name"]=> string(8) "Kinszasa" ["id"]=> int(17) } }

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:
34.53 ms | 403 KiB | 8 Q