<?php
$result = array(
"2018-08-30" => 8,
"2018-08-31" => 2,
"2018-09-04" => 4,
"2018-09-20" => 1,
"2018-09-24" => 1,
"2018-09-27" => 2,
);
$dateRanges = array(
"2018-08-28" => 0,
"2018-08-29" => 1,
"2018-08-30" => 2,
"2018-08-31" => 3,
"2018-09-01" => 4,
"2018-09-02" => 5,
"2018-09-03" => 6,
"2018-09-04" => 7,
"2018-09-05" => 8,
"2018-09-06" => 9,
"2018-09-07" => 10,
"2018-09-08" => 11,
"2018-09-09" => 12,
"2018-09-10" => 13,
"2018-09-11" => 14,
"2018-09-12" => 15,
"2018-09-13" => 16,
"2018-09-14" => 17,
"2018-09-15" => 18,
"2018-09-16" => 19,
"2018-09-17" => 20,
"2018-09-18" => 21,
"2018-09-19" => 22,
"2018-09-20" => 23,
"2018-09-21" => 24,
"2018-09-22" => 25,
"2018-09-23" => 26,
"2018-09-24" => 27,
"2018-09-25" => 28,
"2018-09-26" => 29,
"2018-09-27" => 30
);
$newArr = array_merge(array_map(function($v){return 0;}, $dateRanges), $result);
print_r($newArr);
- Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- Array
(
[2018-08-28] => 0
[2018-08-29] => 0
[2018-08-30] => 8
[2018-08-31] => 2
[2018-09-01] => 0
[2018-09-02] => 0
[2018-09-03] => 0
[2018-09-04] => 4
[2018-09-05] => 0
[2018-09-06] => 0
[2018-09-07] => 0
[2018-09-08] => 0
[2018-09-09] => 0
[2018-09-10] => 0
[2018-09-11] => 0
[2018-09-12] => 0
[2018-09-13] => 0
[2018-09-14] => 0
[2018-09-15] => 0
[2018-09-16] => 0
[2018-09-17] => 0
[2018-09-18] => 0
[2018-09-19] => 0
[2018-09-20] => 1
[2018-09-21] => 0
[2018-09-22] => 0
[2018-09-23] => 0
[2018-09-24] => 1
[2018-09-25] => 0
[2018-09-26] => 0
[2018-09-27] => 2
)
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Array
(
[2018-08-28] => 0
[2018-08-29] => 0
[2018-08-30] => 8
[2018-08-31] => 2
[2018-09-01] => 0
[2018-09-02] => 0
[2018-09-03] => 0
[2018-09-04] => 4
[2018-09-05] => 0
[2018-09-06] => 0
[2018-09-07] => 0
[2018-09-08] => 0
[2018-09-09] => 0
[2018-09-10] => 0
[2018-09-11] => 0
[2018-09-12] => 0
[2018-09-13] => 0
[2018-09-14] => 0
[2018-09-15] => 0
[2018-09-16] => 0
[2018-09-17] => 0
[2018-09-18] => 0
[2018-09-19] => 0
[2018-09-20] => 1
[2018-09-21] => 0
[2018-09-22] => 0
[2018-09-23] => 0
[2018-09-24] => 1
[2018-09-25] => 0
[2018-09-26] => 0
[2018-09-27] => 2
)
- Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
- Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/SlF0J on line 44
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/SlF0J on line 44
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `')'' in /in/SlF0J on line 44
Process exited with code 255.
preferences:
369.6 ms | 401 KiB | 464 Q