thanatosx Posted May 30, 2007 Share Posted May 30, 2007 I am creating a site that user can post articles but I have a problem with the text.If a user types a very big word without spaces the page will be disorted.How can I break lines between such words? Thanks for your time and I am sorry about my bad english skills Link to comment https://forums.phpfreaks.com/topic/53617-solved-text-problem/ Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 <?php $string = "supercalafragilisticexpaladosous"; $charsperline = 10; $outputlines = array(); $pos = 0; while(!$stop) { $outputlines[] = substr($string, $pos, $charsperline); $pos = $pos + $charsperline; if(substr($string, $pos, $charsperline) == "") { $stop = true; } } foreach($outputlines as $line) { echo "$line<br />"; } ?> Link to comment https://forums.phpfreaks.com/topic/53617-solved-text-problem/#findComment-265016 Share on other sites More sharing options...
thanatosx Posted May 31, 2007 Author Share Posted May 31, 2007 thank you very much Link to comment https://forums.phpfreaks.com/topic/53617-solved-text-problem/#findComment-265412 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.