static function dumpString(
        string $string,
        ?int $maxLength = null,
        ?string $encoding = null,
        ?array $quotes = null,
        ?string $ellipsis = null
    ): string {
        $stringLength = $encoding === null
            ? mb_strlen($string)
            : mb_strlen($string, $encoding);

        $tooLong = $maxLength !== null && $stringLength > $maxLength;

        return
            $quotes[0]
            . addcslashes(
                $tooLong
                    ? ($encoding === null
                    ? mb_substr($string, 0, $maxLength)
                    : mb_substr($string, 0, $maxLength, $encoding)
                )
                    : $string,
                "\000..\037"
            )
            . $quotes[1]
            . ($tooLong ? $ellipsis : '');
    }
static function dumpString(
        string $string,
        ?int $maxLength = null,
        ?string $encoding = null,
        ?array $quotes = null,
        ?string $ellipsis = null
    ): string {
        $stringLength = $encoding === null
            ? mb_strlen($string)
            : mb_strlen($string, $encoding);

        $tooLong = $maxLength !== null && $stringLength > $maxLength;

        return
            $quotes[0]
            . addcslashes(
                $tooLong
                    ? ($encoding === null
                    ? mb_substr($string, 0, $maxLength)
                    : mb_substr($string, 0, $maxLength, $encoding)
                )
                    : $string,
                "\000..\037"
            )
            . $quotes[1]
            . ($tooLong ? $ellipsis : '');
    }
static function dumpString ( string $ string , ? int $ maxLength = null , ? string $ encoding = null , ? array $ quotes = null , ? string $ ellipsis = null ) : string { $ stringLength = $ encoding === null ? mb_strlen ( $ string ) : mb_strlen ( $ string , $ encoding ) ; $ tooLong = $ maxLength !== null && $ stringLength > $ maxLength ; return $ quotes [ 0 ] . addcslashes ( $ tooLong ? ( $ encoding === null ? mb_substr ( $ string , 0 , $ maxLength ) : mb_substr ( $ string , 0 , $ maxLength , $ encoding ) ) : $ string , "\000..\037" ) . $ quotes [ 1 ] . ( $ tooLong ? $ ellipsis : '' ) ; }
Dump a string

All ASCII < 32 will be escaped in C style.

- if $quotes is specified, it should be an array with 2 elements
- if $ellipsis is specified, it will be appended at the end if the string had to be shortened
Dump a string