Here is print_r output of my array:
Array ( [0] => stdClass Object ( [itemId] => 560639000019 [name] => Item no1 [code] =>
A funny alternative
$getIdUnset = function($id) use ($myArray) { foreach($myArray as $key => $obj) { if ($obj->id == $id) { return $key; } } return false; }; if ($unset = $getIdUnset(4)) { unset($myArray[$unset]); }