我需要从数组中找到一个元素。我知道in_array()
方法,但它不适用于这种数组:
Array
(
[0] => stdClass Object
(
[id] => 7
)
[1] => stdClass Object
(
[id] => 11
)
[2] => stdClass Object
(
[id] => 12
)
)
我试过了:
if(in_array($id, $some_array)) {
echo "find";
} else {
echo "not exist";
}