RE: [PHP] if("NANC" < 0) - always evaluates TRUE...

From: Date: Tue, 06 Jan 2004 20:45:36 +0000
Subject: RE: [PHP] if("NANC" < 0) - always evaluates TRUE...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173904@lists.php.net to get a copy of this message
On Tue, 6 Jan 2004, Ivo Pletikosic wrote: > $data = 'NANC'; > if(is_numeric($data) && $data < 0) { die('Not OK'); } Interesting problem, one of the first legit oddities I've seen since joining the list. Anyway, in addition to your workaround, casting the variable as an int also appears to result in the desired behavior: (int)"NANC" < 0 == false -- Kelly Hallman // Ultrafancy

« previous php.general (#173904) next »