public function read(BinaryReader &$br, $length = null)
    {
        if (!$br->canReadBytes(4)) {
            throw new \OutOfBoundsException('Cannot read 4-bytes floating-point, it exceeds the boundary of the file');
        }

        $segment = $br->readFromHandle(4);

        if ($br->getCurrentBit() !== 0) {
            $data = unpack('N', $segment)[1];
            $data = $this->bitReader($br, $data);

            $endian = $br->getMachineByteOrder() === $br->getEndian() ? 'N' : 'V';
            $segment = pack($endian, $data);
        } elseif ($br->getMachineByteOrder() !== $br->getEndian()) {
            $segment = pack('N', unpack('V', $segment)[1]);
        }

        $value = unpack('f', $segment)[1];

        return $value;
    }
public function read(BinaryReader &$br, $length = null)
    {
        if (!$br->canReadBytes(4)) {
            throw new \OutOfBoundsException('Cannot read 4-bytes floating-point, it exceeds the boundary of the file');
        }

        $segment = $br->readFromHandle(4);

        if ($br->getCurrentBit() !== 0) {
            $data = unpack('N', $segment)[1];
            $data = $this->bitReader($br, $data);

            $endian = $br->getMachineByteOrder() === $br->getEndian() ? 'N' : 'V';
            $segment = pack($endian, $data);
        } elseif ($br->getMachineByteOrder() !== $br->getEndian()) {
            $segment = pack('N', unpack('V', $segment)[1]);
        }

        $value = unpack('f', $segment)[1];

        return $value;
    }
public function read ( BinaryReader & $ br , $ length = null ) { if ( ! $ br -> canReadBytes ( 4 ) ) { throw new \ OutOfBoundsException ( 'Cannot read 4-bytes floating-point, it exceeds the boundary of the file' ) ; } $ segment = $ br -> readFromHandle ( 4 ) ; if ( $ br -> getCurrentBit ( ) !== 0 ) { $ data = unpack ( 'N' , $ segment ) [ 1 ] ; $ data = $ this -> bitReader ( $ br , $ data ) ; $ endian = $ br -> getMachineByteOrder ( ) === $ br -> getEndian ( ) ? 'N' : 'V' ; $ segment = pack ( $ endian , $ data ) ; } elseif ( $ br -> getMachineByteOrder ( ) !== $ br -> getEndian ( ) ) { $ segment = pack ( 'N' , unpack ( 'V' , $ segment ) [ 1 ] ) ; } $ value = unpack ( 'f' , $ segment ) [ 1 ] ; return $ value ; }
Returns a 4-bytes floating-point

@param \PhpBinaryReader\BinaryReader $br
@param null $length

@return float
@throws \OutOfBoundsException
Returns a 4 - bytes floating - point