Whats wrong with my code?



Im getting this error message but im not sure why:
Parse error: syntax error, unexpected ';', expecting T_VARIABLE or '$' on line 10

<!DOCTYPE html>
    $name = "Jake"
    if ($name = Jake) {
        echo "Hello Jake";
    } elseif ($name = John) {
        echo "You're not Jake";
    } else {
        echo "Where's Jake?";

I cant see any mistakes, any ideas?


No semicolon here. :slight_smile:

Also, I believe comparison is done via == not just =.


Thanks for your reply :slight_smile:

Ive changed it to

$name = "Jake";
if ($name == Jake) {
echo "Hello Jake";

Now I have a new message saying:

Use of undefined constant Jake - assumed 'Jake' (line 9)Hello Jake


I should've seen that earlier,

You need to compare $name to "Jake" and "John", because they are strings not variables. :slight_smile:


@cades no they are varriables being declared


You are comparing a variable to two strings.

No they aren't both variables.


:slight_smile:@cades explain that to me



"String enclosed in quotes"