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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
20 - 2 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Thu Sep 29 13:05:52 2022 UTC