note 26185 added to function.wordwrap

From: Date: Mon, 21 Oct 2002 22:07:14 +0000
Subject: note 26185 added to function.wordwrap
Groups: php.notes 
Request: Send a blank email to php-notes+get-38385@lists.php.net to get a copy of this message
this works fine: function wrap($message) { $message = ereg_replace("\r", " \r ", $message); $message = explode(" ", $message); $msg = NULL; foreach ($message as $message) { if(strlen($message) > 30) { $message = wordwrap($message, 30, " ", 1); } $msg .= $message . " "; } $msg = ereg_replace(" \r ", "\r", $msg); do { if (substr($msg, -1) == "\r") { $msg = substr($msg, 0, -1); } elseif (substr($msg, -1) == " ") { $msg = substr($msg, 0, -1); } } while (substr($msg, -1) == " " || substr($msg, -1) == "\r"); return $msg; } -- http://www.php.net/manual/en/function.wordwrap.php http://master.php.net/manage/user-notes.php?action=edit+26185 http://master.php.net/manage/user-notes.php?action=delete+26185 http://master.php.net/manage/user-notes.php?action=reject+26185

« previous php.notes (#38385) next »