Wordwrap your text

Here the function that comes under php i.e wordwrap(). You can use it for wrapping you long string text into multiple lines and easy to read.
Following are the code that help you. Copy and paste the code into your editor save the code as php file and run into you browser.
<?php
// string to be wrapped into multiple lines
// change the text according your requirement
$text = “Word wrap will split this text up into smaller lines, which makes for easier reading and neater layout.” ;
// function will wrapped the string after 20 characters
$text = wordwrap($text, 20, “<br />”);
// print wrapped string
print $text;
?>

Like to share it
Tags: function, php,

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *