note 49345 added to ref.strings
| From: | basslines at gmail dot com | Date: | Tue, 25 Jan 2005 02:44:30 +0000 |
| Subject: | note 49345 added to ref.strings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83905@lists.php.net to get a copy of this message | ||
Useful function for trailing a string .. use it as needed but send feedback! :)
<?php
function str_trail($str,$cutoff,$trail=' ...') {
// Takes a string and cuts it off at a certain point, then adds
// a "trail" afterwards. Useful for long titles, etc. It returns
// the trailed string, or the original string if it didnt trail it.
// Written by Billy Kimble (basslines@gmail.com)
if (strlen($str) > $length) {
$str = substr($str,0,$cutoff) . $trail;
}
return $str;
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.strings.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49345
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49345&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49345&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49345&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49345&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49345&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49345&report=yes
Search -- http://master.php.net/manage/user-notes.php