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

Andrew Dovganyuk
Andrew Dovganyuk
10,633 Points

Hi guys please help my whith solution!:)

I completely do not Understend what is wrong!!!

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

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

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

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




?>
Dan Barrett
Dan Barrett
10,450 Points

what is the response you are getting and what is the expected output?

1 Answer

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

Hi there! I'm going to start you off with some hints here. I will use my name as an example.

  • If I received a GPA of 4.0 it should echo out "Jennifer made the Honor Roll".
  • If I received a GPA of 2.7 it should echo out "Jennifer has a GPA of 2.7".
  • Your echo out for if student two looks correct if student two made a 4.0, but if they didn't it will just echo out their name and nothing more.
  • Your echo out for if student one has a 4.0 is incorrect. If Dave had made a 4.0 it would now be echoing out "Dave has a GPA of GPA". If Dave did not make a 4.0, it will simply echo out "Dave".

I hope these hints help, but let me know if you're still stuck! :sparkles: