PHPMailer\PHPMailer

PHPMailer::normalizeBreaks()public staticWP 1.0

Normalize line breaks in a string. Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. Defaults to CRLF (for message bodies) and preserves consecutive breaks.

Method of the class: PHPMailer{}

No Hooks.

Return

String.

Usage

$result = PHPMailer::normalizeBreaks( $text, $breaktype );
$text(string) (required)
-
$breaktype(string)
What kind of line break to use; defaults to static::$LE
Default: null

PHPMailer::normalizeBreaks() code WP 6.5.2

public static function normalizeBreaks($text, $breaktype = null)
{
    if (null === $breaktype) {
        $breaktype = static::$LE;
    }
    //Normalise to \n
    $text = str_replace([self::CRLF, "\r"], "\n", $text);
    //Now convert LE as needed
    if ("\n" !== $breaktype) {
        $text = str_replace("\n", $breaktype, $text);
    }

    return $text;
}