betterCode() PHP 2025

Voting

: seven plus two?
(Example: nine)

The Note You're Voting On

Thorsten Glaser
15 years ago
Two bugs:

1) your linebreak is wrong

$linebreak = "\r\n";

2) continuation of lines with no whitespace is broken

/*
* the text after the whitespace will have to
* be read again ( + any additional characters
* that came into existence as a result of the
* encoding process after the whitespace)
*
* Also, do not start at 0, if there was *no*
* whitespace in the whole line
*/
if (($i + $addtl_chars) > $whitesp_diff) {
$output .= substr($cur_conv_line, 0,
(strlen($cur_conv_line) - $whitesp_diff)) .
$linebreak;
$i = $i - $whitesp_diff + $addtl_chars;
} else {
/* emit continuation --mirabilos */
$output .= $cur_conv_line .
'=' . $linebreak;
}

<< Back to user notes page

To Top