PHP PHP Basics Daily Exercise Program Conditionals

Laurence Cimosz
Laurence Cimosz
6,372 Points

why is this not working

Why is this not working? I checked over the code and cant find anything wrong.

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

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

//Place your code below this comment
if ($studentOneGpa === 4.0){
  echo "$studentOneName made the Honor Roll";
} else {
  echo "$studentOneName has a GPA of $studentOneGpa";
}

if ($studentTwoGpa === 4.0){
  echo "$studentTwoName made the Honor Roll";
} else {
  echo "$studentTwoName has a GPA of $studentTwoGpa";
}

?>

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 50,905 Points

The PA in your GPA variables is uppercase. However in your if and echo statements you have it lowercase. If you were to run your code in a workspace you would see errors that studentOneGpa and studentTwoGpa are undefined.