src/Util/Strings.php
public static function ord(string $char): int
    {
        if (\function_exists('\mb_ord')) {
            return \mb_ord($char);
        }

        $code = ($c = \unpack('C*', \substr($char, 0, 4))) ? $c[1] : 0;
        if (0xF0 <= $code) {
            return (($code - 0xF0) << 18) + (($c[2] - 0x80) << 12) + (($c[3] - 0x80) << 6) + $c[4] - 0x80;
        }
        if (0xE0 <= $code) {
            return (($code - 0xE0) << 12) + (($c[2] - 0x80) << 6) + $c[3] - 0x80;
        }
        if (0xC0 <= $code) {
            return (($code - 0xC0) << 6) + $c[2] - 0x80;
        }

        return $code;
    }
public static function ord(string $char): int
    {
        if (\function_exists('\mb_ord')) {
            return \mb_ord($char);
        }

        $code = ($c = \unpack('C*', \substr($char, 0, 4))) ? $c[1] : 0;
        if (0xF0 <= $code) {
            return (($code - 0xF0) << 18) + (($c[2] - 0x80) << 12) + (($c[3] - 0x80) << 6) + $c[4] - 0x80;
        }
        if (0xE0 <= $code) {
            return (($code - 0xE0) << 12) + (($c[2] - 0x80) << 6) + $c[3] - 0x80;
        }
        if (0xC0 <= $code) {
            return (($code - 0xC0) << 6) + $c[2] - 0x80;
        }

        return $code;
    }
public static function ord ( string $ char ) : int { if ( \ function_exists ( '\mb_ord' ) ) { return \ mb_ord ( $ char ) ; } $ code = ( $ c = \ unpack ( 'C*' , \ substr ( $ char , 0 , 4 ) ) ) ? $ c [ 1 ] : 0 ; if ( 0xF0 <= $ code ) { return ( ( $ code - 0xF0 ) << 18 ) + ( ( $ c [ 2 ] - 0x80 ) << 12 ) + ( ( $ c [ 3 ] - 0x80 ) << 6 ) + $ c [ 4 ] - 0x80 ; } if ( 0xE0 <= $ code ) { return ( ( $ code - 0xE0 ) << 12 ) + ( ( $ c [ 2 ] - 0x80 ) << 6 ) + $ c [ 3 ] - 0x80 ; } if ( 0xC0 <= $ code ) { return ( ( $ code - 0xC0 ) << 6 ) + $ c [ 2 ] - 0x80 ; } return $ code ; }
Get a decimal code representation of a specific character.

@param   string $char Character.

@return  int
Get a decimal code representation of a specific character .