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

not getting the solution

i am unable to find the solution

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

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

//Place your code below this comment
if($studentOneGPA==4.0){
   $studentOneName=
}
?>

3 Answers

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

Hi there, Ahtisham Bashir! First, it would be helpful to see everything that you've tried. The challenge is not asking you to alter the value of $studentOneName. It's simply asking you to echo out something.

I'm going to post part of it.

if($studentOneGPA == 4.0) {
  echo "$studentOneName made the Honor Roll";
}

You will need to do this for both students and you will also need to follow the instructions for how to set the string if the GPA is not 4.0.

Hope this helps! :sparkles:

$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 "$studentTowName has a GPA of $studentTwoGPA";
}

edited to add markdown -jn

Not sure whats wrong in my code? would you please help.

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

Hi, Mohammad Hashem! First, this would have been better posted as a new question. I only see two things incorrect in the code you posted here. The first is that it is missing the <?php tag at the start. The second is in the very last line. You wrote:

echo "$studentTowName has a GPA of $studentTwoGPA";

But check the spelling of the first variable name where you have "Tow" instead of "Two". That should be:

echo "$studentTwoName has a GPA of $studentTwoGPA";

Hope this helps! :sparkles:

Thank you very much Jennifer