aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-words.md
blob: d25fbd5b8942d847f69602dfa42326b0dc615aa8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
count\_words {#language.modifier.count.words}
============

This is used to count the number of words in a variable.


    <?php

    $smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');

    ?>

       

Where template is:


    {$articleTitle}
    {$articleTitle|count_words}

       

This will output:


    Dealers Will Hear Car Talk at Noon.
    7

       

See also [`count_characters`](#language.modifier.count.characters),
[`count_paragraphs`](#language.modifier.count.paragraphs) and
[`count_sentences`](#language.modifier.count.sentences).