# PHP count_chars Example

We Need To Find How Many Of Each Character There Are In The Below Sentence.

**The quick brown fox jumped over the lazy dog.**

## Result

There were 8 instance(s) of " " in the string.

There were 1 instance(s) of "." in the string.

There were 1 instance(s) of "T" in the string.

There were 1 instance(s) of "a" in the string.

There were 1 instance(s) of "b" in the string.

There were 1 instance(s) of "c" in the string.

There were 2 instance(s) of "d" in the string.

There were 4 instance(s) of "e" in the string.

There were 1 instance(s) of "f" in the string.

There were 1 instance(s) of "g" in the string.

There were 2 instance(s) of "h" in the string.

There were 1 instance(s) of "i" in the string.

There were 1 instance(s) of "j" in the string.

There were 1 instance(s) of "k" in the string.

There were 1 instance(s) of "l" in the string.

There were 1 instance(s) of "m" in the string.

There were 1 instance(s) of "n" in the string.

There were 4 instance(s) of "o" in the string.

There were 1 instance(s) of "p" in the string.

There were 1 instance(s) of "q" in the string.

There were 2 instance(s) of "r" in the string.

There were 1 instance(s) of "t" in the string.

There were 2 instance(s) of "u" in the string.

There were 1 instance(s) of "v" in the string.

There were 1 instance(s) of "w" in the string.

There were 1 instance(s) of "x" in the string.

There were 1 instance(s) of "y" in the string.

There were 1 instance(s) of "z" in the string.

<!doctype html> <html> <head> <meta charset="UTF-8"> <title>PHP count_chars Example Tutorial</title> </head> <body> <?php $data = "The quick brown fox jumped over the lazy dog."; foreach (count_chars($data, 1) as $i => $val) { echo "<p>There were $val instance(s) of \"" , chr($i) , "\" in the string.\n</p>"; } ?> </body> </html>

## Available For Freelance:

I Am Available To Work For You Freelance, See My Skills To See If I Can Help Your Project, If I Can Help You Then Please Contact Me.

My Rates Start From £180 A Day, Discount Prices For Regular Clients And Work Over 3 Days.

I Started To Learn Web Development In 2008, I Did A Few Open University Courses While Working Full Time In The Building Trade, I Managed To Get A Diploma With Distinction

## Request A Tutorial

If You Are Having Difficulty With The Development Of Your Website Or If You Are Just Starting Out Leaning Web Development And You Think I Can Help You Then Request A Tutorial, I Will Do My Best To Help You

I Dont Charge For My Services If I Can Help You With Something That Can Be Be Fixed In A Few Minutes.

## Advertise

If You Would Like To Advertise On This Site Then Please Contact Me, You Will Be Given Login Details To See What Day And Where Clicks Have Come From.

Prices Start From £10 A Month With Discounts Available For 3 Months Or More.

You Can Either Send Me The Banner Advert That You Have Designed Or From £10 I Can Have Designer Design A Banner For You.

### Please Leave A Comment And A Rating

## My Skills:

- PHP 5
- JavaScript
- Jquery
- XHTML Validation
- KineticJS
- HTML5
- CSS - CSS3
- SEO