PHP Character and Word Count


PHP Character and Word Count


This program written with PHP will echo the character count for each character as well as the work count for the entered string.


PHP



<?php
    $string = "this php code will tell us the frequency of each letter in this string including spaces"; 
    $words = str_word_count($string); 
    $chart = count_chars($string, 1); 
    foreach($chart as $letter=>$frequency) echo "Character ".chr($letter)." appears $frequency times<br />";
     echo "Total words in string: $words";
?>

Click here to run this Code




More Free Code Examples


Free Social Media Template


HTML Color Selector


Speed Test



Try these Fun Games by Bobbie:


Ocean Treasures Game


Travel Blast Game New York


Play and Learn Russian


Battlestarship Game



Take a look at these Groovy Codes:


Fun IQ Test


Html Svg Starburst


Javascript Particles Fishes



Read the Latest Breaking Programming and Tech News, Great Articles and Tips:




Codenewz Programming and Tech News








Comments

Popular posts from this blog

Multi-tap Keypad Text Entry

Crypto Mining