note 49344 added to function.str-repeat
| From: | basslines at gmail dot com | Date: | Tue, 25 Jan 2005 02:43:02 +0000 |
| Subject: | note 49344 added to function.str-repeat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83904@lists.php.net to get a copy of this message | ||
useful function for trailing your strings .. use as needed
<?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/function.str-repeat.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49344
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49344&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49344&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49344&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49344&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49344&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49344&report=yes
Search -- http://master.php.net/manage/user-notes.php