Re: Issues with strpos
- From: Michael Sharman <sharmo@xxxxxxxxx>
- Date: Fri, 30 May 2008 18:07:39 -0700 (PDT)
On May 31, 10:58 am, ljb <ljb1...@xxxxxxxxx> wrote:
sha...@xxxxxxxxx wrote:
Not quite sure what's happening here, the docs for strpos() say:
"Returns the position as an integer. If needle is not found, strpos()
will return boolean FALSE."
Looks fine, I can simply do:
if(strpos("michael", "m")
But then the docs go on to say:
"This function may return Boolean FALSE, but may also return a non-
Boolean value which evaluates to FALSE, such as 0 or "". Please read
the section on Booleans for more information. Use the === operator for
testing the return value of this function."
...
I only want a function to tell me if the string was found (>= 0), I
don't care which position it was etc
Use: if (strpos("michael", "m") !== False) ...
Thanks ljb
.
- References:
- Issues with strpos
- From: Michael Sharman
- Issues with strpos
- Prev by Date: Re: following radio & hidden does not work..... help please.
- Next by Date: Re: How to live without "register_globals = On"
- Previous by thread: Issues with strpos
- Next by thread: PHP boolean's
- Index(es):