Код: Выделить всё
$list = Array
(
[Jul] => Array
(
[deposit] => Array
(
[totalcount] => 1
[totalamount] => 12
)
)
[Oct] => Array
(
)
[Nov] => Array
(
)
[Dec] => Array
(
[deposit] => Array
(
[totalcount] => 2
[totalamount] => 2400
)
[withdraw] => Array
(
[totalcount] => 1
[totalamount] => 3000
)
)
)
Код: Выделить всё
foreach ($list as $ekey => $evalue) {
if(!array_column($list[$ekey], 'deposit')){
$list[$ekey]['deposit'] = array(
'totalcount' => 0,
'totalamount' => 0
);
}else if(!array_column($list[$ekey], 'withdraw')){
$list[$ekey]['withdraw'] = array(
'totalcount' => 0,
'totalamount' => 0
);
}
}
Подробнее здесь: https://stackoverflow.com/questions/651 ... array-item