src/PelConvert.php
public static function shortToBytes($value, $endian)
    {
        if ($endian == self::LITTLE_ENDIAN) {
            return chr($value) . chr($value >> 8);
        } else {
            return chr($value >> 8) . chr($value);
        }
    }
public static function shortToBytes($value, $endian)
    {
        if ($endian == self::LITTLE_ENDIAN) {
            return chr($value) . chr($value >> 8);
        } else {
            return chr($value >> 8) . chr($value);
        }
    }
public static function shortToBytes ( $ value , $ endian ) { if ( $ endian == self :: LITTLE_ENDIAN ) { return chr ( $ value ) . chr ( $ value >> 8 ) ; } else { return chr ( $ value >> 8 ) . chr ( $ value ) ; } }
Convert an unsigned short into two bytes.

@param integer $value
the unsigned short that will be converted. The lower
two bytes will be extracted regardless of the actual size passed.

@param boolean $endian
one of {@link LITTLE_ENDIAN} and {@link
BIG_ENDIAN}.

@return string the bytes representing the unsigned short.
Convert an unsigned short into two bytes .