php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48422 Math sum error
Submitted: 2009-05-28 22:44 UTC Modified: 2009-05-29 10:20 UTC
From: fernandokts at msn dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.2.9 OS: Linux
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: fernandokts at msn dot com
New email:
PHP Version: OS:

 

 [2009-05-28 22:44 UTC] fernandokts at msn dot com
Description:
------------
When doing simple math, there is a problem with numbers with 2 digits greater then 07 in sums.
It appears to ignore any numbers starting with a zero that are bigger then 07.

Reproduce code:
---------------
<?
$calc = 01 + 03 + 05 + 06 + 07 + 08;
echo "The result is: $calc";
?>

Expected result:
----------------
The result is: 30

Actual result:
--------------
The result is: 22

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-28 23:27 UTC] rasmus@php.net
You have discovered octal numbers.  Not a bug.
 [2009-05-29 10:20 UTC] derick@php.net
08 = 0... octal numbers.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC