3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "ambition_id" => [ 55 => "55", 60 => "60" ], "target" => [ 0 => "target 1", 1 => "target 2" ], "strides" => [ 0 => "1", 1 => "1" ], "date" => [ 0 => "2017-02-08", 1 => "2017-03-08" ], "frequency" => [ 0 => "1", 1 => "2" ], ]; $result = array(); foreach ($array as $k => $v) { foreach ($v as $kk => $vv) { if ($k == "ambition_id") { $result[] = array($k => $vv); } else { $result[$kk][$k] = $vv; } } } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [ambition_id] => 55 [target] => target 1 [strides] => 1 [date] => 2017-02-08 [frequency] => 1 ) [1] => Array ( [ambition_id] => 60 [target] => target 2 [strides] => 1 [date] => 2017-03-08 [frequency] => 2 ) )

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