/ Published in: PHP
Expand |
Embed | Plain Text
<?php function ellipsis($text, $maxChars = 20, $splitter = '...') { $theReturn = $text; $lastSpace = false; { { } else { if ($lastSpace !== false) { } { } $theReturn .= $splitter; } } return $theReturn; } ?> <?php $text = "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo."; ?>
Comments
Subscribe to comments
You need to login to post a comment.

why not use
string wordwrap ( string $str [, int $width [, string $break [, bool $cut ]]] )