RE: [PHP] if (a == b) ...

From: Date: Thu, 30 Jan 2003 02:23:25 +0000
Subject: RE: [PHP] if (a == b) ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133585@lists.php.net to get a copy of this message
$a === $b TRUE if $a is equal to $b, and they are of the same type. (PHP 4 only) > -----Original Message----- > From: David Freeman [mailto:dfreeman@outbackqld.net.au] > Sent: Wednesday, January 29, 2003 7:39 PM > To: php-general@lists.php.net > Subject: RE: [PHP] if (a == b) ... > > > > > I have a conditional: > > if (a == b) > > > > a is the number 0, but b is a string "Friday August 22". > > > > The condition is evaluating as true, which is not what I want. > > What am I misunderstanding? > > You're comparing a string to a number perhaps? > > I tried this: > > -----8<----- > $a = 0; > $b = "Friday August 22"; > > if ($a == $b) > { > echo "match"; > } else { > echo "no match"; > } > -----8<----- > > and resulted in 'match', then I tried this: > > -----8<----- > $a = "0"; > $b = "Friday August 22"; > > if ($a == $b) > { > echo "match"; > } else { > echo "no match"; > } > -----8<----- > > and resulted in 'no match'. > > It's worth remembering that the number 0 has somewhat special meaning in > php as a true/false indication. > > CYA, Dave > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#133585) next »