i have this project which is blog type where I pull posts submitted from the server. The problem is that when the post is echo(ed) the text goes all in one line , how do I make it go to the next line after certain length?
Here is the code where the text is being posted
$postpost = $result["post_user"];
echo " <b>name</b> = " .$result["username"] ."<br>";
echo " <b>post</b> = " .$result["post"] . "<br>";
echo " <b>date</b> = ".$date["date"]. "
<br><br>----------------------<br><br>";
and here is the output problem
Use wordwrap()
:
// the 80 is the number of characters after which to break:
echo " <b>post</b> = " . wordwrap($result["post"], 80, '<br>') . '<br>';
You may also be interested in nl2br()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With