<?php
$array = array (
47 =>
array (
'2019-02-24' =>
array (
'AVA_Id' => 1,
'AVA_Status' => 'Open'
),
'2019-02-25' =>
array (
'AVA_Id' => 3,
'AVA_Status' => 'Open'
),
'2019-02-28' =>
array (
'AVA_Id' => 4,
'AVA_Status' => 'Close'
),
),
48 => array (
'2019-02-26' =>
array (
'AVA_Id' => 2,
'AVA_Status' => 'Open'
)
)
);
$dates = array (
0 => '2019-02-24',
1 => '2019-02-25',
2 => '2019-02-26',
3 => '2019-02-27',
4 => '2019-02-28',
5 => '2019-03-01',
6 => '2019-03-02'
);
foreach ($array as &$arr) {
foreach ($dates as $date) {
$out[$date] = $arr[$date] ?? array('AVA_Id' => 0, 'AVA_Status' => 'no');
}
$arr = $out;
}
print_r($array);
- Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 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
(
[47] => Array
(
[2019-02-24] => Array
(
[AVA_Id] => 1
[AVA_Status] => Open
)
[2019-02-25] => Array
(
[AVA_Id] => 3
[AVA_Status] => Open
)
[2019-02-26] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-27] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-28] => Array
(
[AVA_Id] => 4
[AVA_Status] => Close
)
[2019-03-01] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-03-02] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
)
[48] => Array
(
[2019-02-24] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-25] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-26] => Array
(
[AVA_Id] => 2
[AVA_Status] => Open
)
[2019-02-27] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-28] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-03-01] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-03-02] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
)
)
- 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
(
[47] => Array
(
[2019-02-24] => Array
(
[AVA_Id] => 1
[AVA_Status] => Open
)
[2019-02-25] => Array
(
[AVA_Id] => 3
[AVA_Status] => Open
)
[2019-02-26] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-27] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-28] => Array
(
[AVA_Id] => 4
[AVA_Status] => Close
)
[2019-03-01] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-03-02] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
)
[48] => Array
(
[2019-02-24] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-25] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-26] => Array
(
[AVA_Id] => 2
[AVA_Status] => Open
)
[2019-02-27] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-02-28] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-03-01] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
[2019-03-02] => Array
(
[AVA_Id] => 0
[AVA_Status] => no
)
)
)
preferences:
167.29 ms | 409 KiB | 183 Q