PHP wordwrap() Function

P
PHP vsprintf() Function
PHP json_decode() Function

what is the syntax of the WORDWRAP() function in php?

wordwrap(string,width,break,cut)
ParameterDescription
stringRequired. Specifies the string to break up into lines
widthOptional. Specifies the maximum line width. Default is 75
breakOptional. Specifies the characters to use as break. Default is “\n”
cutOptional. Specifies whether words longer than the specified width should be wrapped:FALSE – Default. No-wrapTRUE – Wrap
PHP WORDWRAP() method

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);
?>
PHP vsprintf() Function
PHP json_decode() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z