Hello I have two functions here,the first Function will receive scores of students,and convert all scores into Grades,I want the second function to receive and assign each grade to points(weight). Here is what I have tried so far
   function gradeArray($score) {
     if     ($score >= 70)  return "A";
     elseif ($score >= 50)  return "B";
     elseif ($score >= 40)  return "C";
     else                   return "F";
 }
 function grade($grade) {
 $grade=gradeArray($score);
  if     ($grade == "A")  return "1";
 elseif ($grade == "B")  return "2";
  elseif ($grade =="C")  return "3";
   else                   return "4";
 }
  // scores received from HTML form`
    $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>$score</td><td>" . gradeArray($score) . "</td>
     <td>" .       grade($grade) . "</td></tr>";
      }
      echo "</table>";
intended output
      Score  Grade       Points
      55        B            2
      68        B            2
      43        C            3
      78        A            1
After running above code, i get the following errors
Notice: Undefined variable: grade in C:\xampp\htdocs\TEST.php on line 24
Notice: Undefined variable: score in C:\xampp\htdocs\TEST.php
on line 10
Despite of the errors uncounted ,still I get the following results
    Score   Grade       Points
     55     B            4
     68     B            4
     43     C            4
     78     A            4
where did I go wrong?,Help please , i am very junior at php programing
 
     
    