Here is print_r output of my array:
Array ( [0] => stdClass Object ( [itemId] => 560639000019 [name] => Item no1 [code] =>
use array_search:
$a = new stdClass; $b = new stdClass; $a->id = 1; $b->id = 2; $arr = array($a, $b); $index = array_search($b, $arr); echo $index; // prints out 1