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 trialNikola Simic
2,143 Points"Incorrect output"
officially clueless
<?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 $studentOneGPA of STUDENT GPA\n" ;
}
if ($studentTwoGPA == 4.0) {
echo "$studentTwoName made the Honor Roll\n";
} else {
echo "$studentTwoName has a $studentTwoGPA of STUDENT GPA\n";
}
?>
2 Answers
Dave StSomeWhere
19,870 PointsPlease check the instructions again
If the students GPA is not equal to 4.0, within an else block, use the student name variable to replace NAME AND the student GPA variable to replace STUDENT GPA when displaying the following line: NAME has a GPA of STUDENT GPA
You are supposed to use the variable in place of "STUDENT GPA" not "GPA"
So the line should read:
<?php
echo $studentTwoName . 'has a GPA of' . $studentTwoGPA;
?>
Tim Knight
28,888 PointsYou're really close Nikola. You'll want to make sure you're concatenating your variables into the message string. To concatenate PHP you'd use the . (period) character. Then just make sure the output message is exactly what they're looking for. Here's an example of concatenating in PHP that should help.
<?php
$name = "Nikola";
$language = "PHP";
echo $name . " is learning " . $language;
?>
Nikola Simic
2,143 PointsNikola Simic
2,143 PointsThnx :)