3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); $db_results = array( array('cat' => 1, 'id' => 1), array('cat' => 1, 'id' => 2), array('cat' => 2, 'id' => 3), array('cat' => 1, 'id' => 4) ); $category_map = array(); foreach ( $db_results as $row ) { $category_map[ $row['cat'] ][ $row['id'] ] = $row; } print_r($category_map);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [1] => Array ( [1] => Array ( [cat] => 1 [id] => 1 ) [2] => Array ( [cat] => 1 [id] => 2 ) [4] => Array ( [cat] => 1 [id] => 4 ) ) [2] => Array ( [3] => Array ( [cat] => 2 [id] => 3 ) ) )

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