3v4l.org

run code in 300+ PHP versions simultaneously
<?php $trucks = ['Serial' => 12345, 'Wheels' => 4, 'Color' => 'Black']; $trailers = ['Serial' =>4321, 'Length'=>42]; $forklifts = ['Serial' =>5678, 'ForkLength'=>24]; $columns = array_keys(array_merge($trucks, $trailers, $forklifts)); $template = array_fill_keys($columns, null); foreach ([$trucks, $trailers, $forklifts] as $array) { $result[] = array_merge($template, $array); } var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(5) { ["Serial"]=> int(12345) ["Wheels"]=> int(4) ["Color"]=> string(5) "Black" ["Length"]=> NULL ["ForkLength"]=> NULL } [1]=> array(5) { ["Serial"]=> int(4321) ["Wheels"]=> NULL ["Color"]=> NULL ["Length"]=> int(42) ["ForkLength"]=> NULL } [2]=> array(5) { ["Serial"]=> int(5678) ["Wheels"]=> NULL ["Color"]=> NULL ["Length"]=> NULL ["ForkLength"]=> int(24) } }

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:
143.42 ms | 407 KiB | 5 Q