Forum Moderators: coopster

Message Too Old, No Replies

Counting the occurrence of a character in a string

Counting the occurrence of a character in a string

         

gdog

10:13 am on Oct 11, 2004 (gmt 0)

10+ Year Member



Hey,

I am just trying to count the number of occurrences of a character in a string e.g.

How many times does "a" appear in "Do you want an email notification of replies?"

Is there a PHP function that does this?

Thanks
G

Birdman

11:18 am on Oct 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

Welcome to Webmaster World!

substr_count() [php.net] will do it for you.

PHP Manual Index [php.net]