3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ['ID' => 1], ['ID' => 2], ['ID' => 3], ['ID' => 4], ['ID' => 5], ]; $array2 = [ ['ID' => 2, 'NUM' => 200], ['ID' => 4, 'NUM' => 400], ]; $lookup = array_column($array2, null, 'ID'); var_export( array_map( fn($row) => $row + ($lookup[$row['ID']] ?? ['NUM' => 0]), $array1 ) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'ID' => 1, 'NUM' => 0, ), 1 => array ( 'ID' => 2, 'NUM' => 200, ), 2 => array ( 'ID' => 3, 'NUM' => 0, ), 3 => array ( 'ID' => 4, 'NUM' => 400, ), 4 => array ( 'ID' => 5, 'NUM' => 0, ), )

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