WordPress at a glance
function is not described

PHPMailer\PHPMailer

PHPMailer::base64EncodeWrapMB() public WP 1.0

Encode and wrap long multibyte strings for mail headers without breaking lines within a character. Adapted from a function by paravoid.

{} It's a method of the class: PHPMailer{}

No Hooks.

Return

String.

Usage

$PHPMailer = new PHPMailer();
$PHPMailer->base64EncodeWrapMB( $str, $linebreak );
$str(string) (required)
multi-byte text to wrap encode
$linebreak(string)
string to use as linefeed/end-of-line

Notes

Code of PHPMailer::base64EncodeWrapMB() WP 5.7.2

<?php
public function base64EncodeWrapMB($str, $linebreak = null)
{
    $start = '=?' . $this->CharSet . '?B?';
    $end = '?=';
    $encoded = '';
    if (null === $linebreak) {
        $linebreak = static::$LE;
    }

    $mb_length = mb_strlen($str, $this->CharSet);
    //Each line must have length <= 75, including $start and $end
    $length = 75 - strlen($start) - strlen($end);
    //Average multi-byte ratio
    $ratio = $mb_length / strlen($str);
    //Base64 has a 4:3 ratio
    $avgLength = floor($length * $ratio * .75);

    $offset = 0;
    for ($i = 0; $i < $mb_length; $i += $offset) {
        $lookBack = 0;
        do {
            $offset = $avgLength - $lookBack;
            $chunk = mb_substr($str, $i, $offset, $this->CharSet);
            $chunk = base64_encode($chunk);
            ++$lookBack;
        } while (strlen($chunk) > $length);
        $encoded .= $chunk . $linebreak;
    }

    //Chomp the last linefeed
    return substr($encoded, 0, -strlen($linebreak));
}