3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'ticket_number' => 'sdfsdfsdf 2', 'strategy_id' => '5', 'journal_entries_strategy_conditions' => [ 0 => [ 'strategies_condition_id' => '' ], 1 => [ 'strategies_condition_id' => '1' ] ], 'timeframe' => '', ]; foreach ($array['journal_entries_strategy_conditions'] as $i => $row) { if (!$row['strategies_condition_id']) { array_splice($array['journal_entries_strategy_conditions'], $i, 1); } } var_export($array);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
array ( 'ticket_number' => 'sdfsdfsdf 2', 'strategy_id' => '5', 'journal_entries_strategy_conditions' => array ( 0 => array ( 'strategies_condition_id' => '1', ), ), 'timeframe' => '', )

preferences:
88.74 ms | 407 KiB | 5 Q