<?php
$data = 'This is quite a long string, which will get broken up because the line is going to be too long after base64 encoding it.';
// RFC 2045 に基づき $data をフォーマットします
$new_string = chunk_split(base64_encode($data));
echo $new_string, PHP_EOL;
?>