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 Quote 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 />"; } ?> Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/53617-solved-text-problem/#findComment-265412 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.