note 34744 added to function.strpos
| From: | Dan at rack1 dot php dot net | Date: | Tue, 05 Aug 2003 17:17:57 +0000 |
| Subject: | note 34744 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53439@lists.php.net to get a copy of this message | ||
I found this very helpful to search without worrying about
case sensitivity.
//-----
// Convert $string_a to lower case & store in another variable
$string_b = strtolower($string_a );
// Find the string, case insensitive
$result = strpos("$string_b", "$search_term");
if ($result !== false)
{
// this echoes your string in its original form
echo "$string_a". " was found";
//-----that's it!
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34744
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34744&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34744&report=yes