All this does is cuts a string after a certain amount of characters.
Here is the code and I will explain the usage afterwards:
Usage:
I coded this for a project I'm making at the moment and thought it may come in handy for people.
Enjoy.
Here is the code and I will explain the usage afterwards:
PHP:
function cut( $str, $length )
{
return ( strlen( $str ) > $length ) ? substr( $str, 0, $length ) . "..." : $str;
}
Usage:
PHP:
$string = "Mark Eriksson is the best and is very sexy";
echo cut( $string, 10 );
//will echo:
//Mark Eriks...
//with the '...'
I coded this for a project I'm making at the moment and thought it may come in handy for people.
Enjoy.