Seo Forum

Coding & Programming => Programming Forum => Topic started by: chinmay.sahoo on 12-19-2015, 02:51:59

Title: Wrapping Text
Post by: chinmay.sahoo on 12-19-2015, 02:51:59
Sometimes it is helpful to be able to display a line of text in the user's web browser so that it fi ts neatly into a column of width no more than a specifi ed number of characters.

The wordwrap function takes three arguments: a string, a number and another string. If variable $str has the value "The time has come, the Walrus said, to talk of many things" the function call wordwrap($str,15,"<br>") will return a string broken up every 15 characters at most by the replacement of a space character by the separator "<br>". For this example the string returned will be "The time has <br> come, the <br> Walrus said, to <br> talk of many <br> things". The reason why "<br>" was chosen as the separator was that when output in a web browser this string is displayed in 'word wrapped' form as