ID:               45415
 Updated by:       [EMAIL PROTECTED]
 Reported By:      aurorakay at yeah dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Math related
 Operating System: Linux 2.6.23-tuxonice-r10-
 PHP Version:      5.2.6
 New Comment:

On manual page
http://www.php.net/manual/en/language.operators.bitwise.php you can find
this comment:

"If both the left- and right-hand parameters are strings, the bitwise
operator will operate on the characters' ASCII values."

In your first example they're not both strings but in the second they
are..hence the wrong result. This is not a bug -> bogus.




Previous Comments:
------------------------------------------------------------------------

[2008-07-04 11:58:34] aurorakay at yeah dot net

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 = =

------------------------------------------------------------------------

[2008-07-02 11:59:28] [EMAIL PROTECTED]

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

Reply via email to