1/6 Parse Error


#1

Hi,

This is for exercise 1/6: Glance at the Past. My code is being accepted when I submit it, but I can't get the desired results to print on screen. Here's my code and result, respectively:

Code:

<!DOCTYPE html>
<html>
    <head>
		<title></title>
	</head>
	<body>
    <?php
    
    $name == "John"
    
    if ($name == "John") {
        echo "I know you";
    }
    else if ($name == "Eric") {
        echo "I know you too";
    }
    else {
        echo "Who are you?";
    };
    
    ?>
    </body>
</html>

Result:

Parse error: syntax error, unexpected T_IF on line 11

Hope you can help me out!

Thanks!


#2

You have to insert a semicolon at the end of this line

$name == "John"

like this

$name == "John";

#3

Hi Rydan,

Thanks for that. I got a new error after that. Pasting my code and results here. Hope you can help me out again.

Thanks!


#4

you wrote

$name == "John";//== is a comparison operator

should be

$name = "John";//= is the assignment  operator

I missed that the first ime


#5

That fixed it. Thanks rydan!