Reputation: 237
Guys i just wanna ask if there's a possibility: for example $currenttext = "someexamplepls";
if you would like to show or print it just use print "$currenttext";
then the prepared output look like this someexamplepls
. My question is if i would like to print it like this:
somee
xampl
epls
in every 5 character there is automatic newline what should I do?
Upvotes: 2
Views: 5100
Reputation: 318518
Use wordwrap()
:
echo wordwrap($str, 5, "\n", true);
In case you want HTML linebreaks use <br>
instead of \n
.
Upvotes: 10