Guest User

Untitled

a guest
May 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  1. <?php
  2. function split_content($words = 15) {
  3.     $str = strip_tags($item->get_content());
  4.     $a = preg_split("/[\s]+/", $str, $words + 1);
  5.     $a = array_slice($a, 0, $words);
  6.     $final_content = join(' ', $a);
  7.     echo $final_content;
  8. }
  9. ?>
Add Comment
Please, Sign In to add comment