$a = pack("v","0xABCD");
$b = pack("v",0xABCD);
$w = "test.bin";
$fp = fopen($w,"wb");
$v = fwrite($fp,$a.$b);
$v = fclose($fp);
When I look at the hexdump, it shows : 00 00 CD AB. The string content of $a
is ignored, $b
is correctly inserted. How can I fix that, as the hex values are generated as strings ?