This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Ctype::convert_int_to_char_for_ctype( string|int $int )

Converts integers to their char versions according to normal ctype behaviour, if needed.


Description

If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative values have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string containing the decimal digits of the integer.


Parameters

$int

(string|int) (Required)


Return

(mixed)


Source

File: vendor/symfony/polyfill-ctype/Ctype.php

    private static function convert_int_to_char_for_ctype($int)
    {
        if (!\is_int($int)) {
            return $int;
        }

        if ($int < -128 || $int > 255) {
            return (string) $int;
        }

        if ($int < 0) {
            $int += 256;
        }

        return \chr($int);
    }