PHP Classes

File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-characters.md

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-characters.md   Download  
File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-characters.md
Role: Example script
Content type: text/markdown
Description: Example script
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change:
Date: 2 months ago
Size: 985 bytes
 

Contents

Class file image Download

count_characters

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

Basic usage

{$myVar|count_characters}

Parameters

| Parameter | Type | Required | Description | |-----------|---------|----------|------------------------------------------------------------------------| | 1 | boolean | No | This determines whether to include whitespace characters in the count. |

Examples

<?php

    $smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');

Where template is:

    {$articleTitle}
    {$articleTitle|count_characters}
    {$articleTitle|count_characters:true}

Will output:

    Cold Wave Linked to Temperatures.
    29
    33
   

See also count_words, count_sentences and count_paragraphs.