PHP wordwrap Function

What is wordwrap Function?

Explanation

In PHP this function is used to write a formatted string to a stream.

Syntax:


wordwrap(string,width,break,cut)

In the above syntax "string" specifies the string to break up into lines, "width" specifies maximum line width, "break" specifies the character to use as break, "cut" specifies whether words longer than the specified width should be wrapped.

Example :


<?php
$str = "An example on a long word is: Supercalifragulistic";
echo wordwrap($str,15);
?>
Result :

An example on a long word is: Supercalifragulistic

In the above wordwrap Function example the output is displayed according to the width specified.

PHP Topics


Ask Questions

Ask Question