in_array() does loose comparisons ($a == $b) unless you pass TRUE to the third argument, in which case it does strict comparisons ($a === $b).
Semantically, in_array($obj, $arr) is identical to this:
foreach ($arr as &$member) {
if ($member == $obj) {
return TRUE;
}
}
return FALSE;
...and in_array($obj, $arr, TRUE) is identical to this:
foreach ($arr as &$member) {
if ($member === $obj) {
return TRUE;
}
}
return FALSE;
...and to quote the manual on what this actually checks:
When using the comparison operator (==), object variables are compared in a simple manner, namely: Two object instances are equal if they have the same attributes and values, and are instances of the same class.
On the other hand, when using the identity operator (===), object variables are identical if and only if they refer to the same instance of the same class.