3v4l.org

run code in 300+ PHP versions simultaneously
<?php $reasons = [ "1" => [ "101" => "reason1", "102" => "reason2", ], "2" => [ "201" => "reason3", "202" => "reason4", ], ]; $newReasons = array_reduce($reasons, function ($list, $item) { // 配列のキーを維持するため + で結合 return $list + $item; }, []); var_dump($newReasons);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [101]=> string(7) "reason1" [102]=> string(7) "reason2" [201]=> string(7) "reason3" [202]=> string(7) "reason4" }

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:
102.09 ms | 405 KiB | 5 Q