3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array ( 0 => array ( 'description' => '5390BF675E1464F32202B', 'to_email' => 'test@test.com' ), 1 => array ( 'description' => '5390BF675E1464F32202B', 'to_email' => 'test3@test.com' ), 2 => array ( 'description' => '5390BF675E1464F32202B', 'to_email' => 'testagain@gmail.com' ) ); $array2 = array ( 0 => array ( 'to_email' => 'test@test.com' ), 1 => array ( 'to_email' => 'test3@test.com' ) ); $exclude_ids = array_column($array2, 'to_email', 'to_email'); $output = array_filter($array1, function ($v) use ($exclude_ids) { return !isset($exclude_ids[$v['to_email']]); }); print_r($output);
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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Array ( [2] => Array ( [description] => 5390BF675E1464F32202B [to_email] => testagain@gmail.com ) )

preferences:
140.22 ms | 407 KiB | 5 Q