note 49121 deleted from function.array-search by felipe
| From: | felipe@php.net | Date: | Sun, 10 Feb 2008 13:10:14 +0000 |
| Subject: | note 49121 deleted from function.array-search by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-135956@lists.php.net to get a copy of this message | ||
Note Submitter: Swoog DOT News A@T LaPoste DOT NET_DELME
----
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 ! ;)