note 59257 added to function.wordwrap

From: Date: Wed, 30 Nov 2005 20:48:16 +0000
Subject: note 59257 added to function.wordwrap
Groups: php.notes 
Request: Send a blank email to php-notes+get-99386@lists.php.net to get a copy of this message
If you'd like to break long strings of text but avoid breaking html you may find this useful. It seems to be working for me, hope it works for you. Enjoy. :) function textWrap($text) { $new_text = ''; $text_1 = explode('>',$text); $sizeof = sizeof($text_1); for ($i=0; $i<$sizeof; ++$i) { $text_2 = explode('<',$text_1[$i]); if (!empty($text_2[0])) { $new_text .= preg_replace('#([^\n\r .]{25})#i', '\\1 ', $text_2[0]); } if (!empty($text_2[1])) { $new_text .= '<' . $text_2[1] . '>'; } } return $new_text; } ---- Manual Page -- http://www.php.net/manual/en/function.wordwrap.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59257 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59257&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59257&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59257&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59257&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59257&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59257&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59257&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59257&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99386) next »