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'));

preferences:
52.22 ms | 402 KiB | 5 Q