From: Ron Piggott on 13 May 2010 00:01 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"; }
From: "Lawrance Shepstone" on 13 May 2010 04:08 -----Original Message----- From: Ron Piggott [mailto:ron.php(a)actsministries.org] Sent: 13 May 2010 06:02 AM To: PHP General Subject: [PHP] 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. Best of luck, Lawrance
From: Warren Windvogel on 13 May 2010 04:15 Ron Piggott wrote: > $subjects = "Delivery Status Notification(Failure)"; > > Here is my syntax: > > if ( stristr( $subjects, "Delivery Status Notifcation(Failure)" ) ) { > Notification is misspelled. Next time copy and paste the comparison string or use regular expressions to be more safe. Kind regards Warren -- Developer The University of the Witwatersrand Email: warren.windvogel(a)wits.ac.za Gmail: wwindvogel(a)gmail.com MSN: wwindvogel(a)hotmail.com Skype: wwindvogel Tel: +27 11 717 7184 Cell: +27 73 264 6700 Fax2Email: 0862950483
From: Peter Lind on 13 May 2010 04:15 On 13 May 2010 10:08, Lawrance Shepstone <php(a)digitalvoice.co.za> wrote: > -----Original Message----- > From: Ron Piggott [mailto:ron.php(a)actsministries.org] > Sent: 13 May 2010 06:02 AM > To: PHP General > Subject: [PHP] 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>
From: "Lawrance Shepstone" on 13 May 2010 04:23 On 13 May 2010 10:08, Lawrance Shepstone <php(a)digitalvoice.co.za> wrote: > -----Original Message----- > From: Ron Piggott [mailto:ron.php(a)actsministries.org] > Sent: 13 May 2010 06:02 AM > To: PHP General > Subject: [PHP] 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 ____________________________________________________________________________ Agreed ;-)
|
Pages: 1 Prev: function/class to convert IDN (Puny-Code)? Next: Parse question |