2fb7c898e03803fb256c3292580dbafde9542fbb
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Smarty-2.6.0 / libs / plugins / modifier.count_characters.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  * @package Smarty\r
5  * @subpackage plugins\r
6  */\r
7 \r
8 \r
9 /**\r
10  * Smarty count_characters modifier plugin\r
11  *\r
12  * Type:     modifier<br>\r
13  * Name:     count_characteres<br>\r
14  * Purpose:  count the number of characters in a text\r
15  * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php\r
16  *          count_characters (Smarty online manual)\r
17  * @param string\r
18  * @param boolean include whitespace in the character count\r
19  * @return integer\r
20  */\r
21 function smarty_modifier_count_characters($string, $include_spaces = false)\r
22 {\r
23     if ($include_spaces)\r
24        return(strlen($string));\r
25 \r
26     return preg_match_all("/[^\s]/",$string, $match);\r
27 }\r
28 \r
29 /* vim: set expandtab: */\r
30 \r
31 ?>\r