php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10715 -0 Returns true as an integer
Submitted: 2001-05-07 15:04 UTC Modified: 2001-08-06 19:45 UTC
From: pillaged at hotmail dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.0.5 OS: Debian GNU/Linux
Private report: No CVE-ID: None
 [2001-05-07 15:04 UTC] pillaged at hotmail dot com
$number = -0;
	if (is_integer($number) == true) 
		{
    echo "number is an integer";
	}
	else {
	    echo "number is not an integer";
	}

/* -0 just generally works as a number it probably shouldn't */ 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-22 15:48 UTC] andy@php.net
I believe this is probably because the negative sign is
stripped from -0, so the variable just reads 0 (which is an
integer.)  Can anybody else verify this?
 [2001-08-06 19:45 UTC] jeroen@php.net
-0 is just a strange way of writing 0
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Nov 16 23:01:41 2019 UTC