PHP wordwrap() Function

PHP wordwrap() Function

The wordwrap() Function wraps a string to a given number of characters using a string break character.

Syntax

Parameter

str(required)- This parameter specifies the input string.      

width(optional)– This parameter represents the number of characters at which the string will be wrapped. The default value for this parameter is 75.

break(optional)– This parameter specifies the characters to use as break. The default value is “\n”.

cut(optional)- It specifies whether words longer than the specified width should be wrapped or not. If the parameter is set to TRUE, the string is always wrapped at or before the specified width else for false the function does not split the word

Return

This function returns the given string wrapped at the specified length on success or returns false on failure.

Example 1

Output

Example 2

Output

Example 3

Output

Example 4

Output