tags:

views:

237

answers:

1

How can I do this Perl code in PHP?

 print unpack ("H*", pack ("B*", "00000000100000012000000" ));
+4  A: 

Since pack/unpack in PHP doesn't support the B type, you'll have to use PHP's other functions instead. In this case, dechex and bindec.

echo dechex( bindec( "00000000100000012000000" ));

Edit: Or do it in a single function with base_convert:

echo base_convert("00000000100000012000000", 2, 16);
R. Bemrose
also got a diferent answer from devshedhttp://forums.devshed.com/php-development-5/perl-unpack-pack-to-php-697140.html
netcrash