Tengo este codigo en python que funciona genial, pero no logro pasarlo a php ya que soy bastante nuevo en este interprete, por lo cual les pido ayuda de pasar de python a php.
Transforma 4bytes hexa (MBF) (utilizado también en antiguos archivos btrieve) a un número decimal (float).
import struct
b = bytes([0x00, 0x00, 0x38, 0x85]) # Salida 23
#b = bytes([0x00, 0x00, 0x40, 0x86]) # Salida 48
as_int = struct.unpack('i', b)
if not as_int:
print("Error 1")
exit
man = int(struct.unpack('H', b[2:])[0])
if not man:
print("Error 2")
exit
exp = (man & 0xff00) - 0x0200
man = man & 0x7f | (man << 8) & 0x8000
man |= exp >> 1
bytes2 = bytes([b[0], b[1], (man & 255), ((man >> 8) & 255)])
print(struct.unpack('f', bytes2)[0])
Desde ya muchas gracias por la ayuda que me puedan dar.