johnwayne77 Posted February 20, 2009 Share Posted February 20, 2009 this is my problem: http://www.phpfreaks.com/forums/index.php/topic,238956.0.html i tried the wordwrap but it didn't help me anyone guru on that subject? it really screws up my project Link to comment https://forums.phpfreaks.com/topic/146121-solved-any-tutorial-on-how-to-use-wordwrap-function/ Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 Ok, yeah I think wordwrap function is really only good when you are trying to keep a sentence to a minimal and wrapping the extra words to the next line. Your issue is that you have ONE word that is long.. I don't think wordwrap function will breakup your text....am I correct? Use this: ### Start StringTrim $string_count = strlen($name); if($string_count > 32) { $new_name = substr("$name", 0, 29); $new_name .= "..."; $name = $new_name; } ### End StringTrim You can set the "32" to whatever you want. And the "29" gives you the three dots (...) Link to comment https://forums.phpfreaks.com/topic/146121-solved-any-tutorial-on-how-to-use-wordwrap-function/#findComment-767095 Share on other sites More sharing options...
johnwayne77 Posted February 20, 2009 Author Share Posted February 20, 2009 well, that's what i want: the extra characters to brake up on the next line and so on. i already truncate the text to a specific length.. i got this solution: $string="7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"; $row=chunk_split($string,50); echo("<table><tr><td width='100'>".$row.";</td></tr></table>"); what do you say? Link to comment https://forums.phpfreaks.com/topic/146121-solved-any-tutorial-on-how-to-use-wordwrap-function/#findComment-767117 Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 well, that's what i want: the extra characters to brake up on the next line and so on. i already truncate the text to a specific length.. i got this solution: $string="7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"; $row=chunk_split($string,50); echo("<table><tr><td width='100'>".$row.";</td></tr></table>"); what do you say? If it works for you I say go for it!! Link to comment https://forums.phpfreaks.com/topic/146121-solved-any-tutorial-on-how-to-use-wordwrap-function/#findComment-767127 Share on other sites More sharing options...
johnwayne77 Posted February 20, 2009 Author Share Posted February 20, 2009 ok, this works: $newtext = wordwrap($titlurez, 8, "\n", true); is better than chunk_split Link to comment https://forums.phpfreaks.com/topic/146121-solved-any-tutorial-on-how-to-use-wordwrap-function/#findComment-767143 Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 ok, this works: $newtext = wordwrap($titlurez, 8, "\n", true); is better than chunk_split Great! You fixed your own issue! Link to comment https://forums.phpfreaks.com/topic/146121-solved-any-tutorial-on-how-to-use-wordwrap-function/#findComment-767146 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.