strange stripos behavior
| From: | Bruce Cowin | Date: | Mon, 23 Jul 2007 04:23:01 +0000 |
| Subject: | strange stripos behavior | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-259355@lists.php.net to get a copy of this message | ||
I'm using PHP 5.1 on IIS. I have an app that uses MimeDecode to load
mime files and I've built an object to parse them into their various
parts; i.e., $msg->Body(), $msg->Sender(), etc. I'm using stripos() to
look for a string (that I know is in my test files). It works if I
search in $msg->Body(), but doesn't work if I build a variable and
search it. i.e.,
this works:
if (!stripos($msg->Body(), 'xxxx') === false)
{
echo "\n found in Body()\n";
}
but this doesn't (I've tried it with and without htmlentities()):
$searchtext = htmlentities($msg->Sender()) . htmlentities($msg->To()) .
htmlentities($msg->Cc()) . htmlentities($msg->Subject()) .
htmlentities($msg->Body());
if (!stripos($searchtext, 'xxxx') === false)
{
echo "\nstring found!\n";
}
Does anyone have any ideas? Thanks.
Regards,
Bruce