August 17, 2024
PHP wordwrap
You can wrap words after a specific number of characters in a string with using wordrap() PHP's built in function.
Code
<?php
$variable = "The quick brown fox jumped over the lazy dog.";
$new_variable = wordwrap($variable, 30, "
\n");
echo $newtext;
?>
Output
The quick brown fox jumped
over the lazy dog.