I used unpack() to make my binary[] from C# into an array of something? To push it to the database with a POST. But with my GET, I want to send back the byte[] or now a medium blob from the database.
Do I use the same format with pack() as I did with unpack()?
$arrData = unpack("H*hex", $bytes);
$content = "0x" . $arrData['hex'];
Advertisement
Answer
Yes, you can use the same format, but without the name suffix.
$arrData = unpack("H*hex", $bytes);
$bytes = pack('H*', $arrData['hex']); // H* only