public static function getLong( $b, $offset )
    {
        $val =  (
            (ord($b[$offset++]))        | 
            (ord($b[$offset++]) << 8)   | 
            (ord($b[$offset++]) << 16)  | 
            (ord($b[$offset  ]) << 24)
        );

        // convert signed int to unsigned int if on 32 bit operating system
        if ($val < 0 && PHP_INT_SIZE == 4) {
            $val = sprintf("%u", $val);
        } 

        return $val;
    }