3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 2 => 'John', 21 => 'John', 32 => 'Joe', 42 => 'John', 23 => 'Joe', 62 => 'John', 25 => 'Joe', ); $flipped = []; foreach($arr AS $key => $value) { $flipped[$value][] = $key; } print_r($flipped);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [John] => Array ( [0] => 2 [1] => 21 [2] => 42 [3] => 62 ) [Joe] => Array ( [0] => 32 [1] => 23 [2] => 25 ) )

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:
24.82 ms | 406 KiB | 5 Q