Friday, 23 January 2015

Wordwrap in PHP - PHP

Using wordwrap we can create line breaks in the given text by defining the length.
<?php
$long_text = 'CHMOD comes as a set of 3 numbers. Each of these 3 numbers is a sum total of 3 other numbers. So you have to add 3 numbers to get the first CHMOD number, ';
$long_text .= 'add 3 numbers to get the second CHMOD number';
$long_text .= ' and add 3 numbers to get the third CHMOD number.';

$new_text = wordwrap($long_text, 20, "<br/>n", true);

print $new_text;
?>

0 comments:

Post a Comment