PHP Programing language

wordwrap() Function in PHP
Previous Home Next

wordwrap()

The wordwrap() function wraps a string into new lines when it reaches a specific length.

Syntax:
wordwrap(string,width,break,cut)

In above syntax, "string" specifies the string to break up into lines, "width" specifies the maximum line width default is 75, "break" specifies the characters to use as break default is "\n" and "cut" specifies whether words longer than the specified width should be wrapped means if it is 'FALSE': Default or No-wrap and 'TRUE': Wrap.

Example:

<?php
$str = "Always bear in mind that your own resolution 
	to succeed is more important than any one thing.";
echo wordwrap($str,15,"<br>\n");
?>

Output:

 


Always bear in
mind that your
own resolution
to succeed
is more
important than
any one thing.

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: