word_wrap()

word_wrap($str[, $charlim = 76])

Parameters:
  • $str (string) – Input string
  • $charlim (int) – Character limit
Returns:

Word-wrapped string

Return type:

string

Wraps text at the specified character count while maintaining complete words.

Example:

$string = "Here is a simple string of text that will help us demonstrate this function.";
echo word_wrap($string, 25);

// Would produce:
// Here is a simple string
// of text that will help us
// demonstrate this
// function.
doc_CodeIgniter
2016-10-15 16:32:47
Comments
Leave a Comment

Please login to continue.