PHP to Ruby
Convert PHP code into Ruby!
-
pack
Posted on June 25th, 2009 No commentsThe pack function packs the given arguments into a binary string according to format provided as a parameter.
PHP
$binary_string = pack("nvc*", 0x1234, 0x5678, 65, 66);
Ruby
a = [0x1234, 0x5678, 65, 66]; binary_string = a.pack("nvc*");
Leave a reply


