O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Strings

For the most part, the string functions create strings from other strings or report about the properties of a string. The exception is the eval function, which executes a string as if it were a line of code in your PHP script.

array count_chars(string data, integer mode)string count_chars(string data, integer mode)

The count_chars function analyzes a string by the characters present. The mode argument controls the return value. Modes 0, 1 and 2 return an array. Modes 3 and 4 return a string. If mode is left out, mode 0 is used.

If mode is 0, an array is returned indexed by ASCII codes, 0–255. Each element is set with the count for that character. If mode is 1, only the elements with count greater than zero are returned. If mode is 2, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required