Re: stristr query trouble

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

 



On 13 May 2010 10:08, Lawrance Shepstone <php@xxxxxxxxxxxxxxxxxx> wrote:
> -----Original Message-----
> From: Ron Piggott [mailto:ron.php@xxxxxxxxxxxxxxxxxx]
> Sent: 13 May 2010 06:02 AM
> To: PHP General
> Subject:  stristr query trouble
>
> I am not understanding why 'true' isn't the result of this syntax because
> $subjects equals:
>
> $subjects = "Delivery Status Notification(Failure)";
>
> Here is my syntax:
>
> if ( stristr( $subjects, "Delivery Status Notifcation(Failure)" ) ) {
> $TIRSFlag = true;
> echo "true";
> }
>
> _________________________________________________________________________
>
> You have misspelled 'Notification' in your comparison ...
>
> You should probably use Regular Expressions for this kind of thing.
>

Regexes are best used when what you need to match is dynamic or in a
dynamic string. When you know what the output will be and can match
it, the str* functions are much better as they are much more
efficient.

Regards
Peter

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

-- 
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