#19012 [Opn->Bgs]: is_integer doesn't return true

From: Date: Wed, 21 Aug 2002 08:11:59 +0000
Subject: #19012 [Opn->Bgs]: is_integer doesn't return true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17419@lists.php.net to get a copy of this message
ID: 19012 Updated by: cynic@php.net Reported By: craesh@craesh.net -Status: Open +Status: Bogus Bug Type: Variables related Operating System: Linux PHP Version: 4.2.2 New Comment: 2.0 is not an integer. is_integer(2.0) returns false, which is '' in string contexts. Previous Comments: ------------------------------------------------------------------------ [2002-08-21 03:45:22] craesh@craesh.net It's just that is_integer( $a_double_value ) doesn't seem to return true nor anything else if the double matches a integer value. Just try this script: <?php $a = 2.0; $b = 1.0; echo is_integer( $a/$b ); echo is_integer( 2.0 ); // Doesn't output anything echo is_integer( 2 ); echo is_integer( 2/1 ); echo is_int( 2 ); // These 3 test do output "1" ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19012&edit=1

« previous php.bugs (#17419) next »