[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."
[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
[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
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
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
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
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
7 matches
Mail list logo