Re: Problem with inserting numbers...

From: Date: Thu, 11 Aug 2011 12:05:05 +0000
Subject: Re: Problem with inserting numbers...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-314491@lists.php.net to get a copy of this message
Le 11/08/2011 13:08, Tamara Temple a écrit :
On Aug 10, 2011, at 8:22 PM, Jason Pruim wrote:
while ($num != "10000") {
Problem is here ^ You are testing a numeric $num with a string "10000", which $num will *never* equal. Leave off the quotes on the number. Hum, I suggest you read this page properly :
http://www.php.net/manual/en/types.comparisons.php exemple : <?php $num = 1; $num++; print ($num != 2 ? "different" : "equal") . PHP_EOL . ($num != "2" ? "different" : "equal") . PHP_EOL; print ($num !== 2 ? "different" : "equal") . PHP_EOL . ($num !== "2" ? "different" : "equal") . PHP_EOL; result : equal equal equal different

« previous php.general (#314491) next »