So i'm following this tutorial and this is the code i'm up to.
It's giving me the following error.
Can anyone explain why please.
Figured it out myself.
I was missing a . between $this->name and "."
PHP:
<!DOCTYPE html>
<?php
class Dog {
public $numLegs = 4;
public $name;
public function __construct($name) {
$this->name = $name
}
public function bark() {
return "Woof!";
}
public function greet() {
return "Hello, my name is" . $this->name ".";
}
}
$dog1 = new Dog("Barker")
$dog2 = new Dog("Amigo")
echo $dog1->bark();
echo $dog2->greet();
?>
It's giving me the following error.
Parse error: syntax error, unexpected '}' in CODE on line 9
Errors parsing CODE
Can anyone explain why please.
Figured it out myself.
I was missing a . between $this->name and "."