PHP Exercises: Check if the number of 3's is greater than the number of 5's
113. Compare Count of 3's and 5's in Array
Write a PHP program to check if the number of 3's is greater than the number of 5's.
Sample Solution:
PHP Code :
Sample Output:
bool(true) bool(false) bool(false)
Flowchart:

For more Practice: Solve these Related Problems:
- Write a PHP script to count the frequency of the numbers 3 and 5 in an array and return true if the count of 3's exceeds that of 5's.
- Write a PHP function to tally occurrences of 3 and 5 in an array and compare their counts.
- Write a PHP program to implement a counter for specific digits in an array and output a boolean based on the count comparison.
- Write a PHP script to use a loop or array_count_values() to determine whether the number 3 appears more frequently than the number 5.
PHP Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a PHP program to check if the sum of all 5' in the array exactly 15 in a given array of integers.
Next: Write a PHP program to check if a given array of integers contains a 3 or a 5.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.