note 91642 deleted from function.wordwrap by danbrown

From: Date: Wed, 05 May 2010 14:18:03 +0000
Subject: note 91642 deleted from function.wordwrap by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168971@lists.php.net to get a copy of this message
Note Submitter: James ---- 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); } ?>

« previous php.notes (#168971) next »