src/PelConvert.php
public static function bytesToShort($bytes, $offset, $endian)
    {
        if ($endian == self::LITTLE_ENDIAN) {
            return (ord($bytes{$offset + 1}) * 256 + ord($bytes{$offset}));
        } else {
            return (ord($bytes{$offset}) * 256 + ord($bytes{$offset + 1}));
        }
    }
public static function bytesToShort($bytes, $offset, $endian)
    {
        if ($endian == self::LITTLE_ENDIAN) {
            return (ord($bytes{$offset + 1}) * 256 + ord($bytes{$offset}));
        } else {
            return (ord($bytes{$offset}) * 256 + ord($bytes{$offset + 1}));
        }
    }
public static function bytesToShort ( $ bytes , $ offset , $ endian ) { if ( $ endian == self :: LITTLE_ENDIAN ) { return ( ord ( $ bytes { $ offset + 1 } ) * 256 + ord ( $ bytes { $ offset } ) ) ; } else { return ( ord ( $ bytes { $ offset } ) * 256 + ord ( $ bytes { $ offset + 1 } ) ) ; } }
Extract an unsigned short from bytes.

@param string $bytes
the bytes.

@param integer $offset
the offset. The short found at the offset will be
returned as an integer. There must be at least two bytes
available beginning at the offset given.
@param boolean $endian
one of {@link LITTLE_ENDIAN} and {@link
BIG_ENDIAN}.
@return integer the unsigned short found at offset, e.g., an integer
in the range 0 to 65535.
Extract an unsigned short from bytes .