Some strings of texts may lack necessary wraps and don’t have natural line breaks in them so that the lines are too long to read comfortably. Therefore, you want a way to insert line breaks in to the string every dozens of characters.
The php function you need is wordwrap():
$s = ' ... '; // very long single line string text $s_wrapped = wordwrap($s, 60); // $s is wrapped by every 60 characters and evaluated to $s_wrapped
Line breaks are inserted into the original text every 60 characters.
2 thoughts on “PHP: Wrap Long Lines | Insert Line Breaks into a Long String”
Dude, you messed it up!
Comments are closed.