3v4l.org

run code in 300+ PHP versions simultaneously
<?php $first_arrays = [ ['itemId' => 2, 'title' => 'someTitle', 'bulk_id' => 4], ['itemId' => 3, 'title' => 'someTitle', 'bulk_id' => 5], ['itemId' => 4, 'title' => 'someTitle', 'bulk_id' => 6], ]; $second_arrays = [ ['info' => 'someInfo', 'bulk_id' => 6], ['info' => 'someInfo', 'bulk_id' => 5], ['info' => 'someInfo', 'bulk_id' => 4], ]; function sort_by_bulk(array $a, array $b) : int { return $a['bulk_id'] <=> $b['bulk_id']; } usort($first_arrays, 'sort_by_bulk'); usort($second_arrays, 'sort_by_bulk'); $combined = array_map('array_merge', $first_arrays, $second_arrays); var_dump($combined);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(4) { ["itemId"]=> int(2) ["title"]=> string(9) "someTitle" ["bulk_id"]=> int(4) ["info"]=> string(8) "someInfo" } [1]=> array(4) { ["itemId"]=> int(3) ["title"]=> string(9) "someTitle" ["bulk_id"]=> int(5) ["info"]=> string(8) "someInfo" } [2]=> array(4) { ["itemId"]=> int(4) ["title"]=> string(9) "someTitle" ["bulk_id"]=> int(6) ["info"]=> string(8) "someInfo" } }

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:
93.79 ms | 1731 KiB | 4 Q