PHP example - How to wrap a string to a given number of characters?
PHP - How to wrap a string to a given number of characters?
For this purpose you may use the wordwrap function which is available from PHP 4.0.2
<?php
$myString="long teeeeeeeext";
echo (wordwrap( $myString, 6 ));
?>
will display:
long
teeeee
eeext