3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'ticket_number' => 'sdfsdfsdf 2', 'strategy_id' => '5', 'journal_entries_strategy_conditions' => [ 0 => [ 'strategies_condition_id' => '' ], 1 => [ 'strategies_condition_id' => '1' ] ], 'timeframe' => '', ]; $filtered = array_filter(array_column($arr['journal_entries_strategy_conditions'], 'strategies_condition_id')); $arr['journal_entries_strategy_conditions'] = array_intersect_key($arr['journal_entries_strategy_conditions'], $filtered); var_dump($arr);
Output for 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.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
array(4) { ["ticket_number"]=> string(11) "sdfsdfsdf 2" ["strategy_id"]=> string(1) "5" ["journal_entries_strategy_conditions"]=> array(1) { [1]=> array(1) { ["strategies_condition_id"]=> string(1) "1" } } ["timeframe"]=> string(0) "" }

preferences:
138.85 ms | 408 KiB | 5 Q