note 11303 added to in_array
| From: | al at humantouch dot de | Date: | Thu, 15 Feb 2001 06:48:17 +0000 |
| Subject: | note 11303 added to in_array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11094@lists.php.net to get a copy of this message | ||
Everywhere you use: search in haystack for needle
--- strstr($hay,$needle) ---
Here you use: search for needle in haystack
--- in_array($needle,$hay) ---
Why switch logic?
Better make a new function like:
array_contains($hay,$neddle)
returning the elements number or false
http://www.php.net/manual/en/function.in-array.php