Return to Snippet

Revision: 24208
at February 23, 2010 15:28 by jmiller


Initial Code
// Trims a string down to a certain length and inserts an ellipses if it was trimmed.
function cut($str, $len=30) {
	if (strlen($str) > $len) {
		return substr($str, 0, $len-2) . '&#133';
	} else {
		return $str;
	}
}

Initial URL


Initial Description


Initial Title
Trim string to certain length and insert ellipses

Initial Tags


Initial Language
PHP