Skip to content

Instantly share code, notes, and snippets.

@LaffinToo
Created December 8, 2011 08:48
Show Gist options
  • Save LaffinToo/1446485 to your computer and use it in GitHub Desktop.
Save LaffinToo/1446485 to your computer and use it in GitHub Desktop.
Trims Text for display
// Cut Text
// Cuts a string down and adds a ... signifier
// @Param1 - Text
// @Param2 - Optional Length, default 40 characters
// Return - Text Cut down to length
function CutText($var,$len=40)
{
return strlen($var)>$len?substr($var,0,($len-3)):$var;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment