Very short snippet: PHP word cut


/ Published in: PHP
Save to your folder(s)

Word Cut Function


Copy this code and paste it in your HTML
  1. /**
  2.  * String word cut
  3.  *
  4.  * @private
  5.  */
  6. function _wpmutility_wordCut($content, $limit){
  7. $content = explode(' ',$content);
  8. for($i=0; $i<$limit; $i++) $summary[$i] = $content[$i];
  9. $summary = implode(' ', $summary).'...';
  10. return $summary;
  11. }

URL: http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.