note 85441 added to function.wordwrap
| From: | mn_nospamplz_bayazit at g_mail dot com | Date: | Sun, 31 Aug 2008 01:21:50 +0000 |
| Subject: | note 85441 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144020@lists.php.net to get a copy of this message | ||
This should wrap long lines of code, maintaining the proper level of indentation, plus an extra tab
to indicate it's been wrapped.
<?php
function codewrap($code, $maxLength = 80)
{
$lines = explode("\n", $code);
$count = count($lines);
for($i=0; $i<$count; ++$i) {
preg_match('
^\s*', $code, $matches);
$lines[$i] = wordwrap($lines[$i], $maxLength, "\n$matches[0]\t");
}
return implode("\n", $lines);
}
?>
----
Server IP: 216.235.15.211
Probable Submitter: 70.71.107.94
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/85441
Del: integrated -- https://master.php.net/note/delete/85441/integrated
Del: useless -- https://master.php.net/note/delete/85441/useless
Del: bad code -- https://master.php.net/note/delete/85441/bad+code
Del: spam -- https://master.php.net/note/delete/85441/spam
Del: non-english -- https://master.php.net/note/delete/85441/non-english
Del: in docs -- https://master.php.net/note/delete/85441/in+docs
Del: other reasons-- https://master.php.net/note/delete/85441
Reject -- https://master.php.net/note/reject/85441
Search -- https://master.php.net/manage/user-notes.php