php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32211 Hexadecimal integer value above 32-bit doesn't convert to float
Submitted: 2005-03-07 02:24 UTC Modified: 2005-03-31 17:58 UTC
From: osp at tinet dot org Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.10 OS: Linux and Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: osp at tinet dot org
New email:
PHP Version: OS:

 

 [2005-03-07 02:24 UTC] osp at tinet dot org
Description:
------------
Hexadecimal values that don't fit a 32-bit size are not converted to float as specified on documentation:

"Integer overflow
If you specify a number beyond the bounds of the integer type, it will be interpreted as a float instead."

This works for decimal numbers, but not hexadecimal.


Reproduce code:
---------------
<?php

$myvalue = 0x100000000;  // 33-bit value
//$myvalue = 4294967296;

echo $myvalue."<br>";

var_dump( $myvalue );

?>

Expected result:
----------------
4294967296
float(4294967296)

(0x100000000)


Actual result:
--------------
2147483647
int(2147483647)

(0x7FFFFFFF)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-07 08:10 UTC] derick@php.net
Documentation is wrong here...
 [2005-03-31 17:58 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Added explanatory example in the docs.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 07:01:32 2025 UTC