Page 1 of 1

How to convert Binary_String into true Binary

Posted: Tue Jul 20, 2004 12:04 am
by myleow
Is there a way to convert a Binary String meaning "101101011" into a Binary 101101011?

If it is by using Bitwise Manipulation, please point out the tutorial for bitwise operator in the PHP manual since i cannot find it.

What is got is a binary_string that is say "11111111", what i really want to do is add "00010000" from that binary_string and return the new binary_string.

Anyone know how to do this?

Thank you in advance

Regards
Mian

Posted: Tue Jul 20, 2004 12:20 am
by feyd
that's not a minus.. that'd be a xor, or complement - and...

[php_man]base_convert[/php_man]

Posted: Tue Jul 20, 2004 1:00 am
by JAM
There is also the [php_man]bindec[/php_man]() and [php_man]decbin[/php_man]() functions worth looking at...

Code: Select all

$bin_str = '11111111';
    $add = '00010000';
    echo decbin(bindec($bin_str) + bindec($add)); // 100001111