RE: [PHP] strpos error (I'm missing something obvious)

2007-10-02 Thread Jay Blanchard
[snip] > !== FALSE is not good either, it is not a valid test > > strpos returns the numeric position of the first occurrence of needle in > the haystack string. Except when needle doesn't occur in string, in which case "If needle is not found, strpos() will return boolean FALSE."

Re: [PHP] strpos error (I'm missing something obvious)

2007-10-01 Thread Tom Swiss
[EMAIL PROTECTED] ("Jay Blanchard") writes: > !== FALSE is not good either, it is not a valid test > > strpos returns the numeric position of the first occurrence of needle in > the haystack string. Except when needle doesn't occur in string, in which case "If needle is not found, s

RE: [PHP] strpos error (I'm missing something obvious)

2007-10-01 Thread Jay Blanchard
[snip] I fixed this by changing === TRUE to !== FALSE, so I think I am good to go now. But would still like to know why TRUE doesn't work. Thanks. [/snip] !== FALSE is not good either, it is not a valid test strpos returns the numeric position of the first occurrence of needle in the haystack s

Re: [PHP] strpos error (I'm missing something obvious)

2007-10-01 Thread Carlton Whitehead
Kevin, I think I addressed that in my last message, if a bit indirectly. strpos will never return a boolean true. It will only ever return either the integer where the needle is found in the haystack, or false if said needle is not found in said haystack. Check the Return Values section at

Re: [PHP] strpos error (I'm missing something obvious)

2007-10-01 Thread Kevin Murphy
I fixed this by changing === TRUE to !== FALSE, so I think I am good to go now. But would still like to know why TRUE doesn't work. Thanks. -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada College www.wnc.edu 775-445-3326 P.S. Please note that my e-mail and website

Re: [PHP] strpos error (I'm missing something obvious)

2007-10-01 Thread Carlton Whitehead
Kevin, Try this instead: $site = "http://www.wnc.edu";; $referer = $_SERVER["HTTP_REFERER"]; echo $referer;// the output is correct at: http://www.wnc.edu/test/ if (is_int(strpos($referer, $site))) { echo "yes"; } Why did I make this change? strpos returns an integer representing the

[PHP] strpos error (I'm missing something obvious)

2007-10-01 Thread Kevin Murphy
Overly simplified version of my code. $site = "http://www.wnc.edu";; $referer = $_SERVER["HTTP_REFERER"]; echo $referer; // the output is correct at: http://www.wnc.edu/test/ if (strpos($referer,$site) === TRUE) { echo "yes"; } Why doesn't it echo out "yes"? I know I am doing somethin