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

conditionals

am falling to understand the error on line 13

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

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

//Place your code below this comment
var_dump($studentOneGPA ==4.0);
var_dump($studentTwoGPA ==4.0);
if ($studentTwoName == 4.0); {
echo 'made honor roll';
} elseif ($studentOneGPA = "") {
echo 'has a GPA of 3.8';
}

?>

1 Answer

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

Hi there, Fortunate Chiratidzo Mandizvidza! The cause of your current error is an extraneous semicolon after the first if conditional.

You typed:

if ($studentTwoName == 4.0); {

But you meant to type:

if ($studentTwoName == 4.0) {

Note the removal of the semicolon between the closed parenthesis and the open curly brace. There will still be more errors, but you will get hints on the next one. Removing the semicolon will fix this particular error.

Hope this helps! :sparkles:

thanks it has removed that error but now failing to understand this error i am getting; "Bummer: You need to check that $studentOneGPA is equal to 4.0" <?php $studentOneName = 'Dave'; $studentOneGPA = 3.8;

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

//Place your code below this comment var_dump($studentOneGPA ==4.0); var_dump($studentTwoGPA ==4.0); if ($studentTwoName == 4.0) { echo 'made honor roll'; } elseif ($studentOneGPA = "") { echo 'has a GPA of 3.8'; }

?>

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

Fortunate Chiratidzo Mandizvidza Hi again! This is one of those times when the Bummer message is very helpful. It says "You need to check that $studentOneGPA is equal to 4.0".

Here's your line:

if ($studentTwoName == 4.0)

But you're not checking that $studentOneGPA is equal to 4.0, you're checking if $studentTwoName is equal to 4.0. Hpe this helps you get a bit further along in the troubleshooting process! :sparkles: