|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: alberto dot vassena at infinito dot it
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 25 17:01:30 2024 UTC