Array ( [0] => stdClass Object ( [list_id] => 53 ) [1] => stdClass Object ( [list_id] => 55 ) [2] => stdClass Object ( [list_id] => 56 ) )
Array ( [0] => 55 )
Array ( [0] => 53 [1] => 56 )
<?php
$obj1 = new stdClass;
$obj1->list_id = 53;
$obj2 = new stdClass;
$obj2->list_id = 55;
$obj3 = new stdClass;
$obj3->list_id = 56;
$array1 = [$obj1, $obj2, $obj3];
$array2 = ['0' =>55];
$array = array_filter($array1, function($val) use($array2){
if (array_search($val->list_id, $array2) === false) {
return true;
} else {
return false;
}
});
var_dump($array);
array(2) {
[0] =>
class stdClass#1 (1) {
public $list_id =>
int(53)
}
[2] =>
class stdClass#3 (1) {
public $list_id =>
int(56)
}
}