#45415 [Fbk->Opn]: function "base_convert" bugs
ID: 45415
User updated by: aurorakay at yeah dot net
Reported By: aurorakay at yeah dot net
-Status: Feedback
+Status: Open
Bug Type: Math related
Operating System: Linux 2.6.23-tuxonice-r10-
PHP Version: 5.2.6
New Comment:
Expected result: e.g.1;
Actual result: e.g.1;
example.1 's result is my want. but in examle.2,I want get the
example.1's result.but actual, it is "string(26)
"10100000001000000010000000" I want get "string(30)
"100000100000001000000010000000" in example.2;
Excuse my poor english = =
Previous Comments:
------------------------------------------------------------------------
[2008-07-02 11:59:28] jani@php.net
Exactly what is the expected and what is the actual results?
------------------------------------------------------------------------
[2008-07-02 11:54:26] aurorakay at yeah dot net
Description:
------------
the same data,but at e.g.1,I convert hex to dec. The value is my wish,
at e.g.2 I convert dec to hex. The value isn't my wish.
Reproduce code:
---------------
/*e.g.1*/
$flag=1<<29;
$mark="0x808080";
$mark=base_convert($mark,16,10);
$flag=$flag | $mark;
$t=(base_convert($flag,10,2));
/* this will print "string(30) "100000100000001000000010000000" */
var_dump($t);
/*e.g.2*/
$flag1=1<<29;
$mark1="0x808080";
$flag1=base_convert($flag1,10,16);
$flag1=$flag1 | $mark1;
$t1=(base_convert($flag1,16,2));
/* this will print "string(26) "10100000001000000010000000" */
var_dump($t1);
Expected result:
----------------
/*e.g.1*/ is my wish.
Actual result:
--------------
e.g.1 print "string(30) "100000100000001000000010000000";
e.g.2 print "string(26) "10100000001000000010000000"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45415&edit=1
Thread (4 messages)