needle in a haystack (Can't find :)
| From: | John Taylor-Johnston | Date: | Mon, 16 Dec 2002 08:23:51 +0000 |
| Subject: | needle in a haystack (Can't find :) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-128375@lists.php.net to get a copy of this message | ||
http://www.php.net/manual/en/function.in-array.php
Can't find the °ù¢# $needle in my $haystack. Why? :p
(It is a serious example :)
<?php
$needle = "Ten things I hate about you";
if(in_array($needle, $haystack)) {
echo "Found it";
}else{
echo "Not there";
}
$haystack = array ("Ten Things I Hate About You",
"10 Things I Hate About You",
"Ten things I hate about you",
"10 things I hate about you",
"Ten Things That I Hate About You",
"10 Things That I Hate About You",
"Ten things that I hate about you",
"10 things that I hate about you",
"ten things I hate about you");