note 94095 added to function.in-array
| From: | WillReiher at osu1 dot php dot net | Date: | Thu, 15 Oct 2009 22:21:25 +0000 |
| Subject: | note 94095 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161796@lists.php.net to get a copy of this message | ||
I know this will probably be very slow over large datasets but I think I have a fairly simple way of
checking whether or not a string is in a simple array.
It's both case-insensitive and works like a "LIKE" function:
<?php
$bool = stristr(implode(' ', $array), $word);
?>
The "space" as glue is unnecessary but it's doesn't matter either way.
----
Server IP: 69.147.83.197
Probable Submitter: 24.68.237.104
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/94095
Del: integrated -- https://master.php.net/note/delete/94095/integrated
Del: useless -- https://master.php.net/note/delete/94095/useless
Del: bad code -- https://master.php.net/note/delete/94095/bad+code
Del: spam -- https://master.php.net/note/delete/94095/spam
Del: non-english -- https://master.php.net/note/delete/94095/non-english
Del: in docs -- https://master.php.net/note/delete/94095/in+docs
Del: other reasons-- https://master.php.net/note/delete/94095
Reject -- https://master.php.net/note/reject/94095
Search -- https://master.php.net/manage/user-notes.php