note 49344 deleted from function.str-repeat by cece

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

« previous php.notes (#83911) next »