RE: [PHP] strpos mystery

2004-07-29 Thread Ford, Mike [LSS]
On 29 July 2004 01:50, Jon Drukman wrote: > with this code fragment: > > > $string='/mobile/phone.html'; > if (strpos($string,'/mobile/')!==false) { print "one: yes\n"; } > if (strpos($string,'/mobile/')===true) { print "two: yes\n"; } > > > > > > only the first if statement prints anything

Re: [PHP] strpos mystery

2004-07-28 Thread Jason Barnett
Heck, even I got it wrong ;) True check below should always fail... Jason Barnett wrote: Because === and !== check the type as well. Of you set $string = 'blah' you'll still get the same result. If you were using != and == both would print. strpos() returns an int, so comparing it to false with ==

Re: [PHP] strpos mystery

2004-07-28 Thread Jason Barnett
Because === and !== check the type as well. Of you set $string = 'blah' you'll still get the same result. If you were using != and == both would print. strpos() returns an int, so comparing it to false with === is always false. The same would be true for true. That's half right. strpos actually *

Re: [PHP] strpos mystery

2004-07-28 Thread Justin Patrin
On Wed, 28 Jul 2004 17:50:01 -0700, Jon Drukman <[EMAIL PROTECTED]> wrote: > with this code fragment: > > > $string='/mobile/phone.html'; > if (strpos($string,'/mobile/')!==false) { print "one: yes\n"; } > if (strpos($string,'/mobile/')===true) { print "two: yes\n"; } > > ?> > > only the first

[PHP] strpos mystery

2004-07-28 Thread Jon Drukman
with this code fragment: $string='/mobile/phone.html'; if (strpos($string,'/mobile/')!==false) { print "one: yes\n"; } if (strpos($string,'/mobile/')===true) { print "two: yes\n"; } ?> only the first if statement prints anything. why is !== false not the same as === true ? -jsd- -- PHP General