I intend to grade the elements of a numerically indexed array in php using function call; my function call does not work: it doesn't grade the elements and I cannot figure out the error in the code.Please help Thanks, in advance
<?php
//function intended to grade array elements
function gradeArray($x){
if($score>= 70){
echo"A";
}
elseif($score >= 50){
echo"B";
}
elseif($score>= 40){
echo"C";
}
else{
echo"F";
}
}
// Array of Scores to be graded
$scores = array ("55", "68", "43", "78");
//Display result in a tabular form
echo"<table border = '1'><th>Score</th><th>Grade</th>";
foreach($scores as $score){
echo"<tr><td>";
echo$score."</td>";
echo"<td>". gradeArray($score);
echo"</td></tr>";
}
echo"</table>";
?>