← All docs

count_chars()

Returns byte-frequency information about a string as a tally or a byte list.

count_chars()

function count_chars(string $string, int $mode = 0): array|string

Returns byte-frequency information about a string as a tally or a byte list.

Parameters:

  • $string (string)
  • $mode (int), default 0, optional

Returns: array|string

Availability

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how count_chars is implemented in the compiler, see the internals page.