<?php
$array = [
0 => [
"label" => "Radiator",
"details" => [[
"label" => "Condition",
"value" => "New",
],
[
"label" => "Type",
"value" => "Wall",
]],
],
1 => [
"label" => "Airco",
"details" => [[
"label" => "Condition",
"value" => "New",
],
[
"label" => "Type",
"value" => "",
]],
],
2 => [
"label" => "Refrigerator",
"details" => [[
"label" => "Condition",
"value" => "Bad",
],
[
"label" => "Type",
"value" => "Wall",
]],
],
];
foreach($array as &$row){
foreach($row['details'] as $key => $record){
if(strlen($record['value']) == 0){
unset($row['details'][$key]);
}
}
}
print_r($array);
preferences:
25.12 ms | 404 KiB | 5 Q