utf8chr example

'"' => '"',
            '/' => '/',
            '\\' => '\\',
            // U+0085 NEXT LINE             'N' => "\xC2\x85",
            // U+00A0 NO-BREAK SPACE             '_' => "\xC2\xA0",
            // U+2028 LINE SEPARATOR             'L' => "\xE2\x80\xA8",
            // U+2029 PARAGRAPH SEPARATOR             'P' => "\xE2\x80\xA9",
            'x' => self::utf8chr(hexdec(substr($value, 2, 2))),
            'u' => self::utf8chr(hexdec(substr($value, 2, 4))),
            'U' => self::utf8chr(hexdec(substr($value, 2, 8))),
            default => throw new ParseException(sprintf('Found unknown escape character "%s".', $value)),
        };
    }

    /** * Get the UTF-8 character for the given code point. */
    private static function utf8chr(int $c): string
    {
        
'"' => '"',
            '/' => '/',
            '\\' => '\\',
            // U+0085 NEXT LINE             'N' => "\xC2\x85",
            // U+00A0 NO-BREAK SPACE             '_' => "\xC2\xA0",
            // U+2028 LINE SEPARATOR             'L' => "\xE2\x80\xA8",
            // U+2029 PARAGRAPH SEPARATOR             'P' => "\xE2\x80\xA9",
            'x' => self::utf8chr(hexdec(substr($value, 2, 2))),
            'u' => self::utf8chr(hexdec(substr($value, 2, 4))),
            'U' => self::utf8chr(hexdec(substr($value, 2, 8))),
            default => throw new ParseException(sprintf('Found unknown escape character "%s".', $value)),
        };
    }

    /** * Get the UTF-8 character for the given code point. */
    private static function utf8chr(int $c): string
    {
        
Home | Imprint | This part of the site doesn't use cookies.