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=
}
?>

2 Answers

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

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:

Mohammad Hashem
Mohammad Hashem
682 Points
$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

Mohammad Hashem
Mohammad Hashem
682 Points

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

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

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: