<?php
function calculatescore($x) {
return [
    substr_count($x, 'Y'), //substr_count-Counts how many times this data is given
    substr_count($x, 'O'),
    substr_count($x, 'U')
     ];
}
print_r (calculatescore("YOU")); // 1,1,1
print_r (calculatescore("YYOOUU)); //2,2,2
print_r (calculatescore("UUUOOYYYY)); //3,2,4
by Gvanca Gharibashvili
2 years ago
PHP
Object Oriented PHP Tutorial
0
Pro tip: use ```triple backticks around text``` to write in code fences