php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47914 Integer begining by 0
Submitted: 2009-04-07 07:41 UTC Modified: 2009-04-07 09:34 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: pserin at afone dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.2.9 OS: Windows / Linux
Private report: No CVE-ID: None
 [2009-04-07 07:41 UTC] pserin at afone dot com
Description:
------------
Any integer begining by 0 is truncated or display wierdly. The only way to get around it is to put the number between commas.

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

$number = 0058434648616;

$multipl = 2;

$result = $number * $multipl;

echo $number." x ".$multipl." = ".$result;

?>

Expected result:
----------------
58434648616 x 2 = 116869297232

Actual result:
--------------
5 x 2 = 10

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-07 09:08 UTC] jani@php.net
Number beginning with 0 is not an integer, it's an octal number. This 
is not a bug.
 [2009-04-07 09:34 UTC] pserin at afone dot com
So what can I do when I have to set a phone number (begining with 0033) and I can't do anything to cast it to a string ?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Dec 27 23:00:01 2025 UTC