3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ColumnKeyClass { function __toString() { return 'first_name'; } } class IndexKeyClass { function __toString() { return 'id'; } } $column_key = new ColumnKeyClass(); $index_key = new IndexKeyClass(); $records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'XXX' ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith' )); var_dump($column_key); var_dump($index_key); $firstNames = array_column($records, $column_key, $index_key); print_r($firstNames); var_dump($column_key); var_dump($index_key);
Output for git.master, git.master_jit, rfc.property-hooks
object(ColumnKeyClass)#1 (0) { } object(IndexKeyClass)#2 (0) { } Array ( [2135] => John [3245] => Sally ) object(ColumnKeyClass)#1 (0) { } object(IndexKeyClass)#2 (0) { }

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:
38.47 ms | 401 KiB | 8 Q