what is the syntax of the WORDWRAP() function in php?
wordwrap(string,width,break,cut)
Parameter | Description |
---|---|
string | Required. Specifies the string to break up into lines |
width | Optional. Specifies the maximum line width. Default is 75 |
break | Optional. Specifies the characters to use as break. Default is “\n” |
cut | Optional. Specifies whether words longer than the specified width should be wrapped:FALSE – Default. No-wrapTRUE – Wrap |
examples of the WORDWRAP() function
Example 1. In this example, we wrap a string into new lines when it reaches a specific length.
<?php
$str = "An example of a long word is: Supercalifragulistic";
echo wordwrap($str,15,"<br>\n");
?>
Example 1. In this example, we wrap a string into new lines.
<?php
$str = "An example of a long word is: Supercalifragulistic";
echo wordwrap($str,15);
?>