Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Daily Exercise Program Conditionals

erika rincon
erika rincon
3,731 Points

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: