I'm stuck on how to reverse a process. This part works:
$ar = unpack("C*", pack("f", -4));
array:4 [▼
1 => 0
2 => 0
3 => 128
4 => 192
]
# in hex
array:4 [▼
1 => "00"
2 => "00"
3 => "80"
4 => "c0"
]
Now I want to do the reverse: I have a hex string '000080c0' and I want to unpack it into a float and have the result be -4. How do I do that in PHP?
Thanks.