PHP 8.5.0 Alpha 4 available for testing

Voting

: five minus five?
(Example: nine)

The Note You're Voting On

zg
16 years ago
<?php

function quoted_printable_encode( $str, $chunkLen = 72 )
{
$offset = 0;

$str = strtr(rawurlencode($str), array('%' => '='));
$len = strlen($str);
$enc = '';

while (
$offset < $len )
{
if (
$str{ $offset + $chunkLen - 1 } === '=' )
{
$line = substr($str, $offset, $chunkLen - 1);
$offset += $chunkLen - 1;
}
elseif (
$str{ $offset + $chunkLen - 2 } === '=' )
{
$line = substr($str, $offset, $chunkLen - 2);
$offset += $chunkLen - 2;
}
else
{
$line = substr($str, $offset, $chunkLen);
$offset += $chunkLen;
}

if (
$offset + $chunkLen < $len )
$enc .= $line ."=\n";
else
$enc .= $line;
}

return
$enc;
}

?>

<< Back to user notes page

To Top