class test { public $a = 0; } $a = new test(); $b = new test(); if(in_array($a, array($b), true)) echo 'in'; else echo 'not in';