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 if statement prints anything. why is !== false not the > same as === true ?
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. > > -jsd- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > !DSPAM:410846c1241919501214933! > > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php