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 trialitai chiriseri
5,127 Pointsi need assistance
i dont know what im missing out in this challenge
<?php
$studentOneName = 'Dave';
$studentOneGPA = 3.8;
$studentTwoName = 'Treasure';
$studentTwoGPA = 4.0;
//Place your code below this comment
if($studentOneGPA==4.0){
echo "$studentOneName has made the Honor Role";
}else{
echo "$studentOneName has a GPA of $studentOneGPA ";
}
if($studentTwoGPA==4.0){
echo "$studentTwoName has made the Honor Role";
}else{
echo "$studentTwoName has a GPA of $studentTwoGPA";
}
?>
3 Answers
Jonathan Grieve
Treehouse Moderator 91,253 PointsMy apologies. The space at the end of the first string wasn't failing the challenge.
However what I said about the string being precise to pass the challenge was correct. There's a slight difference to the string you used and the one the challenge was expecting. Try
<?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 Role";
}else{
echo "$studentOneName has a GPA of $studentOneGPA ";
}
if($studentTwoGPA==4.0){
echo "$studentTwoName made the Honor Role";
}else{
echo "$studentTwoName has a GPA of $studentTwoGPA";
}
?>
Try
<?php
echo "$studentTwoName made the Honor Role";
?>
rather than
<?php
echo "$studentTwoName has made the Honor Role";
?>
Jonathan Grieve
Treehouse Moderator 91,253 PointsYou have a trailing slash in one of your strings that might be fooling the challenge engine. Try changing it to below to see if you get a pass. It needn't be too much of a big issue but the challenges are specific on these things :)
if($studentOneGPA==4.0){
echo "$studentOneName has made the Honor Role";
}else{
echo "$studentOneName has a GPA of $studentOneGPA";
}
itai chiriseri
5,127 Pointsunfortunately its still producing an error
Andrew Phythian
19,747 PointsI've tried this code challenge with code that produces the correct output and unfortunately the challenge has still failed.
Edit: Recoded, after several failed attempt and it passed. Not sure what made the difference in my case.
itai chiriseri
5,127 Pointsitai chiriseri
5,127 Pointsthank you so much that was definitely the error and it worked well