Answer to Question #230756 in HTML/JavaScript Web Application for XXX

Question #230756

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.


1
Expert's answer
2021-08-30T02:29:21-0400
<?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");

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS