3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Array ( [0] => Array ( [label] => Radiator [details] => Array ( [0] => Array ( [label] => Condition [value] => New ) [1] => Array ( [label] => Type [value] => Wall ) ) ) [1] => Array ( [label] => Airco [details] => Array ( [0] => Array ( [label] => Condition [value] => New ) ) ) [2] => Array ( [label] => Refrigerator [details] => Array ( [0] => Array ( [label] => Condition [value] => Bad ) [1] => Array ( [label] => Type [value] => Wall ) ) ) )

preferences:
40.12 ms | 410 KiB | 5 Q