Write a PHP program which will ask the user to key a paragraph or sentence. Then it will help the user to count the character that specified by the user.
<?php
$text = readline("Enter a sentence: ");
$char = readline("Enter a char: ");
$count = 0;
for ($i=0; $i<strlen($text); $i++)
if (char == $text[i])
$count++;
print("Char count $count");
Comments
Leave a comment