PHP PHP Basics Daily Exercise Program Conditionals

Lela Harris
Lela Harris
4,812 Points

My code seems to work but I keep getting the error that I need to check that Student one's GPA is equal to 4.0.

Doesn't the first if statement check that?

index.php
<?php
$studentOneName = 'Dave';
$studentOneGPA = 3.8;

$studentTwoName = 'Treasure';
$studentTwoGPA = 4.0;

//Place your code below this comment
function GPA($studentName, $studentGPA){
if ($studentGPA === 4.0) {
  echo $studentName . " made the Honor Roll";
}
elseif ($studentGPA != 4.0 || $studentGPA < 4.0 ) {
 echo  $studentName . " has a GPA of " . $studentGPA;
}
        }

GPA($studentOneName, $studentOneGPA);
GPA($studentTwoName, $studentTwoGPA);





?>

2 Answers

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,370 Points

Instead of using a function I think the checker wants you to type out all given variables and logic

if ($studentOneGPA === 4.0) { ...

if ($studentTwoGPA === 4.0) { ...

etc.