note 37977 added to function.in-array

From: Date: Wed, 03 Dec 2003 19:38:11 +0000
Subject: note 37977 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-61354@lists.php.net to get a copy of this message
class Test { } $b=new Test(); $a=array(); $a[]=$b; in_array($b, $a); This gives: Warning: in_array(): Wrong datatype for first argument Apparently, you can't search for whether an object instance is already in an array? Pretty weird! I saw one pseudo-workaround on this site about using uniqid(), but this seems horribly inelegant. ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37977 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37977&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37977&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61354) next »