3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array('id' => 1, 'field' => 13, 'value' => 'foo'), array('id' => 3, 'field' => 13, 'value' => 'bar'), array('id' => 4, 'field' => 13, 'value' => 'baz'), array('id' => 2, 'field' => 13, 'value' => 'foo'), array('id' => 1, 'field' => 17, 'value' => 'bar'), array('id' => 2, 'field' => 17, 'value' => 'baz'), ); $result = array(); foreach ($data as $row) { $result[$row['id']][$row['field']] = $row['value']; } ksort($result); var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [1]=> array(2) { [13]=> string(3) "foo" [17]=> string(3) "bar" } [2]=> array(2) { [13]=> string(3) "foo" [17]=> string(3) "baz" } [3]=> array(1) { [13]=> string(3) "bar" } [4]=> array(1) { [13]=> string(3) "baz" } }

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:
45.12 ms | 402 KiB | 8 Q