$num = count($words); while (1) { $line = implode(' ', array_slice($words, 0, $num)); if (strlen($line) > 60) { $num--; } else { array_push($lines, $line); $words = array_slice($words, $num); $num = count($words); if (!count($words)) { break; } } } $first = $indent; if (!$keepIndent) { $other = substr($indent, 0, strlen($indent) - 1); } else { $other = $indent; } $id = $first; foreach ($lines as $line) { echo $id . $line; $id = $other; } } } } $cl = new ChangeLog(); $cl->dumpChangeLog();