XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
modifier.count_words.php
Go to the documentation of this file.
1 <?php
21 function smarty_modifier_count_words($string)
22 {
23  // split text by ' ',\r,\n,\f,\t
24  $split_array = preg_split('/\s+/',$string);
25  // count matches that contain alphanumerics
26  $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array);
27 
28  return count($word_count);
29 }
30 
31 /* vim: set expandtab: */
32 
33 ?>