protected function charToCodePoint($char)
    {
        $code = ord($char[0]);
        if ($code < 128) {
            return $code;
        } elseif ($code < 224) {
            return (($code - 192) * 64) + (ord($char[1]) - 128);
        } elseif ($code < 240) {
            return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128);
        } else {
            return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128);
        }
    }
protected function charToCodePoint($char)
    {
        $code = ord($char[0]);
        if ($code < 128) {
            return $code;
        } elseif ($code < 224) {
            return (($code - 192) * 64) + (ord($char[1]) - 128);
        } elseif ($code < 240) {
            return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128);
        } else {
            return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128);
        }
    }
protected function charToCodePoint ( $ char ) { $ code = ord ( $ char [ 0 ] ) ; if ( $ code < 128 ) { return $ code ; } elseif ( $ code < 224 ) { return ( ( $ code - 192 ) * 64 ) + ( ord ( $ char [ 1 ] ) - 128 ) ; } elseif ( $ code < 240 ) { return ( ( $ code - 224 ) * 4096 ) + ( ( ord ( $ char [ 1 ] ) - 128 ) * 64 ) + ( ord ( $ char [ 2 ] ) - 128 ) ; } else { return ( ( $ code - 240 ) * 262144 ) + ( ( ord ( $ char [ 1 ] ) - 128 ) * 4096 ) + ( ( ord ( $ char [ 2 ] ) - 128 ) * 64 ) + ( ord ( $ char [ 3 ] ) - 128 ) ; } }
Convert a single or multi-byte character to its code point

@param string $char
@return integer
Convert a single or multi - byte character to its code point