[PHP] stristr query trouble

2010-05-13 Thread Ron Piggott


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




RE: [PHP] stristr query trouble

2010-05-13 Thread Lawrance Shepstone
-Original Message-
From: Ron Piggott [mailto:ron@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


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



Re: [PHP] stristr query trouble

2010-05-13 Thread Warren Windvogel

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.windvo...@wits.ac.za

Gmail: wwindvo...@gmail.com
MSN: wwindvo...@hotmail.com
Skype: wwindvogel
Tel: +27 11 717 7184
Cell: +27 73 264 6700
Fax2Email: 0862950483


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



Re: [PHP] stristr query trouble

2010-05-13 Thread Peter Lind
On 13 May 2010 10:08, Lawrance Shepstone p...@digitalvoice.co.za wrote:
 -Original Message-
 From: Ron Piggott [mailto:ron@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

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



RE: [PHP] stristr query trouble

2010-05-13 Thread Lawrance Shepstone
On 13 May 2010 10:08, Lawrance Shepstone p...@digitalvoice.co.za wrote:
 -Original Message-
 From: Ron Piggott [mailto:ron@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 ;-)


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



[PHP] stristr

2004-02-01 Thread Liam
I've been trying to make this error logger for hours now,

I get my webserver to forward all errors to error.php?message=404 etc.. 

The source can be found here
http://the-bronze.me.uk/ID/error.txt

Now Im at my wits end, I want all errors that come internaly eg from the-bronze.me.uk 
to be put into onserver.txt and all other ones to be put into 404.txt 

Unfortuantly I seem to be a little lost and confusded, can anyone see where im going 
wrong as far as my stristr(); usage is and if so what is the problem?

Liam 


Re: [PHP] stristr

2004-02-01 Thread Russell Shaw
Liam wrote:
I've been trying to make this error logger for hours now,

I get my webserver to forward all errors to error.php?message=404 etc.. 

The source can be found here
http://the-bronze.me.uk/ID/error.txt
Now Im at my wits end, I want all errors that come internaly eg from the-bronze.me.uk to be put into onserver.txt and all other ones to be put into 404.txt 

Unfortuantly I seem to be a little lost and confusded, can anyone see where im going wrong as far as my stristr(); usage is and if so what is the problem?
One useful diagnostic method is:

  $match = stristr($_SERVER['HTTP_REFERER'],'the-bronze');
  echo $_SERVER['HTTP_REFERER'] br $match;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php