ConFoo Montreal 2026: Call for Papers

Voting

: max(three, two)?
(Example: nine)

The Note You're Voting On

frans-jan at van-steenbeek dot R-E-M-O-V-E dot net
19 years ago
Using wordwrap is usefull for formatting email-messages, but it has a disadvantage: line-breaks are often treated as whitespaces, resulting in odd behaviour including lines wrapped after just one word.

To work around it I use this:

<?php
function linewrap($string, $width, $break, $cut) {
$array = explode("\n", $string);
$string = "";
foreach(
$array as $key => $val) {
$string .= wordwrap($val, $width, $break, $cut);
$string .= "\n";
}
return
$string;
}
?>

I then use linewrap() instead of wordwrap()

hope this helps someone

<< Back to user notes page

To Top