3v4l.org

run code in 500+ PHP versions simultaneously
<?php $labels = [ 0 => "2023-07-05", 1 => "2023-07-06", 2 => "2023-07-07", 3 => "2023-07-08", 4 => "2023-07-09", 5 => "2023-07-10", 6 => "2023-07-11", ]; $result = [ 0 => [ "numberViews" => 20, "dayDate" => "2023-07-10", ], 1 => [ "numberViews" => 32, "dayDate" => "2023-07-11", ], ]; // Create the output array; set the dates/labels as keys and 0 as values $output = array_fill_keys($labels, 0); // Fill the number of views for the dated that have views foreach ($result as $day) { $output[$day['dayDate']] = $day['numberViews']; } print_r($output);
Output for rfc.property-hooks, git.master_jit, git.master
Array ( [2023-07-05] => 0 [2023-07-06] => 0 [2023-07-07] => 0 [2023-07-08] => 0 [2023-07-09] => 0 [2023-07-10] => 20 [2023-07-11] => 32 )

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:
79.8 ms | 1165 KiB | 4 Q