How to use Wordwrap in PHP

In this article I will explain how Wordwrap() Function can be used in PHP.
  • 1362

Wordwrap() Function

This function wraps a string into new lines when it reaches a specific length.

Syntax

wordwrap(string,width,break,cut)

Example

<html>
<body>
<?php
$str = "An example on a long word is: Satya and Nitin Both are good boys";
echo wordwrap($str,15);
?>
</body>
</html>

 

Output


wordwrap-php.jpg

You may also want to read these related articles Click here

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.