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

György Varga
György Varga
19,198 Points

My code is working as it should, but the Code Challange doesn't accept it...

Hi!

So I wrote this code in my code challange and it runs correctly and displays the requested infromation, but it doesn't accept it.

Can you help me please?

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'."\n";
  } else {
      echo "$studentOneName".' has a gpa of '."$studentOneGPA"."\n";
}

if ($studentTwoGPA >= 4.0) {
  echo "$studentTwoName".' made the Honor Roll'."\n";
  } else {
      echo "$studentTwoName".' has a gpa of '."$studentTwoGPA"."\n";
}
?>
György Varga
György Varga
19,198 Points

Okay I sorted this out! There are some serious issues in this code challange... if I format it differently it will accept the code... Treehouse should look after this issue!

1 Answer

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

Hi there! Close, very close. But your output isn't what the challenge is expecting. In fact, the Bummer! message indicates this:

Bummer! Make sure you use the proper case

Your strings do not match exactly. The "gpa" should be uppercased to "GPA" in both instances. If I make this tiny correction, your code passes!

Challenges can be very exacting even down to spelling, spacing, capitalization, and punctuation. In some instances, if the output does not match every character exactly, the challenge will fail.

Hope this helps! :sparkles: