18.216.94.152 |    

Navigation

Google Advertisement

Cut a tring after n chars and append three points

str_short
  1. // **************************************************************
  2. // str_short -- cut a string after n chars and append three points
  3. //
  4. //      string str_short( string string [, int length] )
  5.  
  6. function str_short ( $str, $len = 30 ) {
  7.  
  8. if ( strlen( $str ) > $len )
  9. 	$str = substr( $str, 0, $len )."...";
  10. return $str;
  11.  
  12. }
Parsed in 0.010 seconds at 33.41 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 6 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)