|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20925 base_convert does not convert a number back to itself
Submitted: 2002-12-10 16:00 UTC Modified: 2002-12-10 17:15 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: alberto dot vassena at infinito dot it Assigned:
Status: Closed Package: Math related
PHP Version: 4.2.3 OS: 2.4.19-16mdk
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:
Solve the problem:
22 - 5 = ?
Subscribe to this entry?

 [2002-12-10 16:00 UTC] alberto dot vassena at infinito dot it
I am expecting that a number with a base X is converted to itself if the base is unchanged.


$number = "987654321";
$after  = base_convert($number, 10, 10);

echo "\nBefore: $number";
echo "\nAfter : $after\n\n";


987654321 gives back, in fact, 987654321.

Unfortunately, this is not always true:


$number = "9876543210";
$after  = base_convert($number, 10, 10);

echo "\nBefore: $number";
echo "\nAfter : $after\n\n";


9876543210 gives back 1286608618

The 4.2.3 version I have been using is the one that comes with the Mandrake 9.0 distribution.
I have been keeping it regularly updated on the web (now is Dec 12th, 2002).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-10 17:15 UTC]
Fixed in CVS. (and in PHP 4.3.0-dev)

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 06:05:54 2023 UTC