3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jobs = [ ['count' => 3, 'yearmonth' => '2019-7'], ['count' => 3, 'yearmonth' => '2019-9'], ['count' => 5, 'yearmonth' => '2019-10'], ]; $dates = [ ['yearmonth' => '2019-6'], ['yearmonth' => '2019-7'], ['yearmonth' => '2019-8'], ['yearmonth' => '2019-9'], ['yearmonth' => '2019-10'], ]; $lookup = array_column($jobs, 'count', 'yearmonth'); foreach ($dates as &$date) { $date['count'] = $lookup[$date['yearmonth']] ?? 0; } var_export($dates);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'yearmonth' => '2019-6', 'count' => 0, ), 1 => array ( 'yearmonth' => '2019-7', 'count' => 3, ), 2 => array ( 'yearmonth' => '2019-8', 'count' => 0, ), 3 => array ( 'yearmonth' => '2019-9', 'count' => 3, ), 4 => array ( 'yearmonth' => '2019-10', 'count' => 5, ), )

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