note 10183 deleted from function.wordwrap by jimw

From: Date: Fri, 14 Dec 2001 20:37:33 +0000
Subject: note 10183 deleted from function.wordwrap by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22765@lists.php.net to get a copy of this message
This isn't really relevant to wordwrap() but it's a way I've come up with to 'break' at after a certain amount of characters. <?php $string_to_break = "This string will be broken"; if(strlen($string_to_break)>25) { $string = substr($string_to_break,0,24); if($string != " ") { $last_space = strrpos($string, " "); $string = substr($string_to_break,0,$last_space); print($string."..."); } else { print($string."..."); } } else { print($string_to_break); } ?> --- This will print: This string will be...

« previous php.notes (#22765) next »