note 49121 added to function.array-search

From: Date: Mon, 17 Jan 2005 16:29:10 +0000
Subject: note 49121 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-83499@lists.php.net to get a copy of this message
for "voituk on asg dot kiev dot ua" : no need to do : (get_class($needle)==get_class($haystack[$i])) && ($needle==$haystack[$i]) for type sensible searches, Because, in PHP, two objects are equals if and only if they have same class and all of their attributes are the same (values). But Because of the untyping of PHP, same attributes can be == but not === so, to avoid problems with type sensible searches, do : $needle===$haystack[$i] Is Better ! ;) ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49121 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49121&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49121&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49121&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49121&report=yes&reason=useless+example Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49121&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49121&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83499) next »