logo CodeStepByStep logo

contains_twice

Language/Type: PHP Boolean string return

Write a function named contains_twice that accepts a string and a character as parameters and returns true if that character occurs two or more times in the string. For example, the call of contains_twice("hello", 'l') should return true because there are two 'l' characters in that string.

Function: Write a PHP function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.