note 64517 deleted from function.wordwrap by danbrown

From: Date: Sun, 17 May 2009 18:32:07 +0000
Subject: note 64517 deleted from function.wordwrap by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155132@lists.php.net to get a copy of this message
Note Submitter: ab_at_notenet(dot)dk ---- The function for wrapping strings without wrapping the html might need a second parameter (lenght): <?php function textWrap($text, $size = 90) { $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 .]{'. $size .'})#i', '\\1 ', $text_2[0]); } if (!empty($text_2[1])) { $new_text .= '<' . $text_2[1] . '>'; } } return $new_text; } ?>

« previous php.notes (#155132) next »