Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Basics Daily Exercise Program Conditionals

I need the error to be more specific.

it out puts what is supposed to but its still giving me wrong output message. Does it have to be in a certain order?

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 GPA of" . $studentOneGPA;
};

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


//if ($studentTwoGPA == 4.0){
 // echo $studentTwoName . "made the Honor Roll";
//} else ($studentTwoGPA != 4.0){
 // $studentTwoName . "has GPA of" . $studentTwoGPA
//}
?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! It's not quite outputting the exact thing it's expecting. Your logic and syntax are spot on, but there are some spacing problems and you're missing a word in two of your strings. Specifically, the indefinite article "a".

Right now, your code for "Dave" outputs this:

Davehas GPA of3.8

But it should output this:

// note the additional spacing after "Dave" and before "3.8"
// Also note the addition of the word "a"
Dave has a GPA of 3.8  

Your code for "Treasure" outputs:

Treasuremade the Honor Roll

But it should output:

// note the additional spacing after the name
Treasure made the Honor Roll

Hope this helps! :sparkles: