PHP PHP Basics Daily Exercise Program Conditionals

Nate Nins
Nate Nins
671 Points

Incorrect output?

I'm getting an "incorrect output" message, but I don't know how the output is supposed to look so I'm not sure how to go about changing my code to reflect the desired output. Any help would be greatly appreciated.

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 . ' has made the Honor Roll';
} else {
  echo ''.$studentOneName.' has a GPA of '.$studentOneGPA.'';
}
if ($studentTwoGPA == 4.0) {
  echo ' ' . $studentTwoName . ' has made the Honor Roll';
} else {
  echo ''.$studentTwoName.' has a GPA of '.$studentTwoGPA.'';
}
?>

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there, Nate Nins ! It looks like you're doing pretty terrific. I feel like maybe you misread part of the instructions.

It should say something like "Nate made the Honor Roll" when they have a GPA of 4.0. Instead, yours has an extra word. It contains the word "has". So yours would say "Nate has made the Honor Roll" as opposed to "Nate made the Honor Roll".

Removing the "has" from the two lines where the GPA is 4.0 causes this to pass :tada:

Hope this helps! :sparkles:

Nate Nins
Nate Nins
671 Points

Of course. Thank you!!!