3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flip($arr) { $result = array(); foreach ($arr as $index => $list) { foreach ($list as $key => $value) { $result[$key][$index] = $value; } } return $result; } $ar1 = array('Магазин 1', 15, 25, 30); $ar2 = array('Магазин 2', 25, 45, 50); $ar3 = array('Месяц', 1, 2, 3); $values = [$ar3, $ar1, $ar2]; var_dump(flip($values));
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> array(3) { [0]=> string(10) "Месяц" [1]=> string(16) "Магазин 1" [2]=> string(16) "Магазин 2" } [1]=> array(3) { [0]=> int(1) [1]=> int(15) [2]=> int(25) } [2]=> array(3) { [0]=> int(2) [1]=> int(25) [2]=> int(45) } [3]=> array(3) { [0]=> int(3) [1]=> int(30) [2]=> int(50) } }

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