note 64873 deleted from function.strpos by bjori
| From: | bjori@php.net | Date: | Sat, 22 Apr 2006 12:52:10 +0000 |
| Subject: | note 64873 deleted from function.strpos by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109011@lists.php.net to get a copy of this message | ||
Note Submitter: hydesign1 at aol dot com
Reason: bad code
----
I've made a workaround of the === boolean operator. Instead of using:
if($pos===false)
I used:
if($pos==true)
It really does the same thing.
Here's my example:
<?php
$inputStr="php rules to the max!";
$searchStr="to";
$searchBool=strpos(" $inputStr",$searchStr);
if($searchBool==true)
{
// found message
echo "The string \"$searchStr\" was found in the string
\"$inputStr\".";
}
else
{
// not found message
echo "The string \"$searchStr\" was not found in the string
\"$inputStr\".";
}
?>
The output would be:
The string "to" was found in the string "php rules to the max!".