PHP Error: Undefined property '$title'. intelephense (1014)
I am getting the error "Undefined property '$title'. intelephense (1014)" for the employee class.
class User {
// Properties are attributes that belong to a class
public $name;
public $email;
public $password;
public function __construct($name, $email, $password) {
$this->name = $name;
$this->email = $email;
$this->password = $password;
}
function set_name($name) {
$this->name = $name;
}
function get_name() {
return $this->name;
}
}
// Inheritence
class Employee extends User {
public function __construct($name, $email, $password, $title)
{
parent::__construct($name, $email, $password);
$this->title = $title;
}
public function get_title() {
return $this->title;
}
}
$employee1 = new Employee('Sara', 'sara@gmail.com', '123', 'manager');
echo $employee1->get_title;
I am also getting the same error for '$get_title' when I try to echo on the last line.
I was expecting to see the employee's title: 'manager'.