Question
Just wondering if someone could double check my work and verify it's ok? I'm coming up with a few errors, any help is appreciated -
Just wondering if someone could double check my work and verify it's ok? I'm coming up with a few errors, any help is appreciated - thank you!
Create a form allowing a user to enter a paragraph of text into a single textarea and click submit. Upon submission, output some statistics including:
The number of sentences
The number of words
The number of characters
The numbers of words that start with a vowel
Lastly, look up a string modifier to remove all punctuation and then output every word in alphabetical order.
My code so far is below, any help is appreciated.
html> lang="en"> charset="UTF-8">Title Here rel="stylesheet" href="style.css">
if (function_exists('word_count')){ function word_count($str, $n = "()"){ $m = strlen($str) / 2; $a = 1; while($a < $m) { $str = str_replace("","", $str); $a++; } $b = explode("", $str); $i = 0; foreach ($b as $u) { $i++; } if($n == 1) return $b; else return $i; } } $str = "Hello php world!"; $c = word_count($str, 1); //if return array $d = word_count($str); //if return how many words in text area print_r($c); echo $d; ?>
Results
Number of sentences: $m; ?>
Word count: $b; ?>
Number of chatacters: $i; ?>
Number of words that start with a vowel: $a; ?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started