note 49345 deleted from ref.strings by cece
| From: | cece@php.net | Date: | Tue, 25 Jan 2005 03:01:50 +0000 |
| Subject: | note 49345 deleted from ref.strings by cece | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83910@lists.php.net to get a copy of this message | ||
Note Submitter: basslines at gmail dot com
Reason: useless
----
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;
}
?>