You are here : phpstringcount_chars

count_chars() - string

Counts the number of occurrences of every byte-value (0..255) in
   string and returns it in various ways.
Parameters :
  • string - The examined string.
  • mode - See return values.

  • Syntax

    mixed count_chars
        ( string $string
       [, int $mode = 0
      ] )


    Example

    <?php$data = "Two Ts and one F.";foreach (count_chars($data, 1) as $i => $val) {   echo "There were $val instance(s) of \"" , chr($i) , "\" in the string.\n";}?>


    Output / Return Value


    Limitations


    Alternatives / See Also


    Reference