Re: [PHP] if(NANC 0) - always evaluates TRUE...
On Tue, 6 Jan 2004 10:57:52 -0800, you wrote: ...no matter what follows the NANC...seems like a bug. if(NA 0) { print(err 1\n); } if(NAN 0) { print(err 2\n); } if(NANC 0) { print(err 3\n); } if (NANC 0) { echo (one); } else { echo (two); } outputs two here, as expected. PHP 4.3.2 over Win2000. Maybe you're seeing a side-effect of a Not A Number magic value being intelligently-evaluated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if(NANC 0) - always evaluates TRUE...
Hello Ivo, Tuesday, January 6, 2004, 6:57:52 PM, you wrote: IP ...no matter what follows the NANC...seems like a bug. IP // output IP err 3 IP err 4 Not for me it doesn't. It outputs nothing (as it should). -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if(NANC 0) - always evaluates TRUE...
Ivo Pletikosic wrote: ...no matter what follows the NANC...seems like a bug. if(NA 0) { print(err 1\n); } if(NAN 0) { print(err 2\n); } if(NANC 0) { print(err 3\n); } if(NANCY 0) { print(err 4\n); } // output err 3 err 4 Same behaviour here, PHP Version 4.3.4 under Linux debian 2.2.17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if(NANC 0) - always evaluates TRUE...
Hi, Never noticed it before...only after the linux box got updated to v4.3.4...running the script against my v4.2.3 also outputs err 3 err4...version 4.0.6 outputs nothing as it should. Odd...not sure where to start digging to figure this...in the meantime I'll work it around like this: $data = 'NANC'; if(is_numeric($data) $data 0) { die('Not OK'); } print('OK'); Where do I file this for developers with some time on their hands to look at? Thanks, Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if(NANC 0) - always evaluates TRUE...
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if(NANC 0) - always evaluates TRUE...
From: Kelly Hallman [EMAIL PROTECTED] 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 This all kind of begs the question of why you'd check if a string was less than zero, anyhow, doesn't it??? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php