Re: Re: strange stripos behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For another guru, I have a question.  I just checked the returns of this
func on php.net to check myself and I see:

This function may return Boolean FALSE, but may also return a
non-Boolean value which evaluates to FALSE, such as 0 or "".

When would stripos() return "" ?

Thanks!
-Shawn

Bruce Cowin wrote:
> Thanks for the suggestion.  I ended up not building the search string
> and checking each part individually.  
> 
> FYI, I had noticed that it also depended on what order I built the
> search string; e.g., $searchstring = $msg->Body() . $msg->Subject()... 
> worked ok but if I put $msg->Subject first it didn't.  Is it possible
> that if $msg->Subject is null that it does something funny to the value
> in the $searchstring variable?
> 
> Anyway, it's working now by not using a variable.  Thanks again.
> 
> 
> 
> Regards,
> 
> Bruce
> 
>>>> Shawn McKenzie <nospam@xxxxxxxxxxxxx> 25/07/2007 12:33 p.m. >>>
> Too much beer to think through the logical progression of the
> operators,
> but maybe try:
> 
> if (stripos($searchtext, 'xxxx') !== false) {
> 
> -Shawn
> 
> Bruce Cowin wrote:
>> 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
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux