Most Referenced Functions
  » google_pagerank()
  » preg_replace()
  » site_pageranks()
  » imagecreatefrompng()
  » htmlentities()
  » imagepng()
  » imagestring()
  » imagedestroy()
  » preg_match()
  » imagecolorallocate()
  » header()
  » fopen()
  » getimagesize()
  » session_start()
  » strstr()
  » preg_match_all()
  » strpos()
  » ob_start()
  » ob_flush()
  » flush()
  » str_replace()
  » array2vars()
  » nl2br()
  » htmlspecialchars()
  » setcookie()
  » urlencode()
  » preg_split()
  » ereg()
  » ereg_replace()
  » var_dump()

Our Sponsors
 » Powerpointing
 » Rock Music Community - meet fans
 » Business Strategy

Become a sponsor for $15/month. Link is sitewide - PR5 homepage, 20+ PR4 pages, 90+ PR3 pages. Email dave[AT]icemelon[D0T]c0m.

Local search Connecticut furniture stores can be found at FurnitureCatch: Furniture Stores Norwalk, Furniture Stores Stamford, Furniture Stores Greenwich, Furniture Stores New Canaan, Furniture Stores Darien
PHP Functions

Function: wordwrap

(PHP 4 >= 4.0.2, PHP 5)

wordwrap --  Wraps a string to a given number of characters using a string break character

Description

string wordwrap ( string str [, int width [, string break [, bool cut]]] )

Returns a string with str wrapped at the column number specified by the optional width parameter. The line is broken using the (optional) break parameter.

wordwrap() will automatically wrap at column 75 and break using ' \n ' (newline) if width or break are not given.

If the cut is set to 1, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken apart. (See second example).

Note: The optional cut parameter was added in PHP 4.0.3

Example 1. wordwrap() example

<?php
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />\n");

echo $newtext;
?>

This example would display:

The quick brown fox<br />
jumped over the lazy<br />
dog.

Example 2. wordwrap() example

<?php
$text = "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "\n", 1);

echo "$newtext\n";
?>

This example would display:

A very
long
wooooooo
ooooord.

Related Function(s)

  • nl2br()
  • chunk_split()
  • swf_actiongeturl()
  • swf_actiongotoframe()
  • swf_actiongotolabel()
  • swf_actionnextframe()
  • swf_actionplay()
  • swf_actionprevframe()
  • swf_actionsettarget()
  • swf_actionstop()
  • swf_actiontogglequality()
  • swf_actionwaitforframe()
  • swf_addbuttonrecord()
  • swf_addcolor()
  • swf_closefile()
  • swf_definebitmap()
  • swf_definefont()
  • swf_defineline()
  • swf_definepoly()
  • swf_definerect()
  • swf_definetext()
  • swf_endbutton()
  • swf_enddoaction()
  • swf_endshape()
  • swf_endsymbol()
  • swf_fontsize()
  • swf_fontslant()
  • swf_fonttracking()
  • swf_getbitmapinfo()
  • swf_getfontinfo()
  • swf_getframe()
  • swf_labelframe()
  • swf_lookat()
  • swf_modifyobject()
  • swf_mulcolor()
  • swf_nextid()
  • swf_oncondition()
  • swf_openfile()
  • swf_ortho2()
  • swf_ortho()
  • swf_perspective()
  • swf_placeobject()
  • swf_polarview()
  • swf_popmatrix()
  • swf_posround()
  • swf_pushmatrix()
  • swf_removeobject()
  • swf_rotate()
  • swf_scale()
  • swf_setfont()
  • swf_setframe()
  • swf_shapearc()
  • swf_shapecurveto3()
  • swf_shapecurveto()
  • swf_shapefillbitmapclip()
  • swf_shapefillbitmaptile()
  • swf_shapefilloff()
  • swf_shapefillsolid()
  • swf_shapelinesolid()
  • swf_shapelineto()
  • swf_shapemoveto()
  • swf_showframe()
  • swf_startbutton()
  • swf_startdoaction()
  • swf_startshape()
  • swf_startsymbol()
  • swf_textwidth()
  • swf_translate()
  • swf_viewport()
  • Icemelon -- PHP, CSS, Javascript Tutorials, & More!
      © 2005-2010 Icemelon.com   Email: dave[AT]icemelon[D0T]c0m