note 91642 added to function.wordwrap

From: Date: Sun, 21 Jun 2009 05:08:04 +0000
Subject: note 91642 added to function.wordwrap
Groups: php.notes 
Request: Send a blank email to php-notes+get-157189@lists.php.net to get a copy of this message
Fixing and extending on the code by: mn_nospamplz_bayazit at g_mail dot com <?php /** * Wrap code while maintaining indentation * @param string $code Input code * @param int $cutoff[optional] Cutoff, if not using PHP default * @param string $delimiter[optional] Delimiter, if using a custom one * @return Wrapped code */ function codeWrap($code, $cutoff = null, $delimiter = " &raquo;\n") { $lines = explode("\n", $code); $count = count($lines); for ($i = 0; $i < $count; ++$i) { preg_match('/^\s*/', $lines[$i], $matches); $lines[$i] = wordwrap($lines[$i], $cutoff, ($delimiter . $matches[0])); } return implode("\n", $lines); } ?> ---- Server IP: 209.41.74.194 Probable Submitter: 58.96.72.249 ---- Manual Page -- http://www.php.net/manual/en/function.wordwrap.php Edit -- https://master.php.net/note/edit/91642 Del: integrated -- https://master.php.net/note/delete/91642/integrated Del: useless -- https://master.php.net/note/delete/91642/useless Del: bad code -- https://master.php.net/note/delete/91642/bad+code Del: spam -- https://master.php.net/note/delete/91642/spam Del: non-english -- https://master.php.net/note/delete/91642/non-english Del: in docs -- https://master.php.net/note/delete/91642/in+docs Del: other reasons-- https://master.php.net/note/delete/91642 Reject -- https://master.php.net/note/reject/91642 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#157189) next »