php.net |  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
Votes:1
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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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.

<?php

$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:

<?php

$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).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Nov 26 23:05:53 2022 UTC