Bug #71933 [Opn->Nab]: Is_int() applied a float cast is incorrect

From: Date: Thu, 31 Mar 2016 15:42:49 +0000
Subject: Bug #71933 [Opn->Nab]: Is_int() applied a float cast is incorrect
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200270@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71933&edit=1 ID: 71933 Updated by: krakjoe@php.net Reported by: daniel dot gimeno at gmail dot com Summary: Is_int() applied a float cast is incorrect -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Ubuntu 14.04 PHP Version: 5.6.19 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2016-03-31 15:29:02] daniel dot gimeno at gmail dot com Description: ------------ The problem is when a float cast it's applied to a variable. Does not matter what is the value of that variable, is_int() will always return a False result. Test script: --------------- $num = (float)2; //it's the same result for 0, 2, 2.0 or 2.3 $isint = is_int($num); var_dump ($num); var_dump($isint); You get: float(2) bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71933&edit=1

« previous php.bugs (#200270) next »