I have the following codes:
<?php
class LongName {
var $firstname = " ";
var $middlename = " ";
var $lastname = " ";
function firstname() {
echo "First Name : ". $this -> firstname;
}
function middlename() {
if (middlename){
echo "Middle Name : ". $this -> middlename;
else echo "Middle name, what is that? ";
}
}
function lastname() {
echo "Last Name : ". $this -> lastname;
}
}
// b)
function firstname2 extends firstname() {
echo "First Name: ".$param;
}
// c)
function lastname2 extends lastname() {
echo "Last Name: ".$param;
}
// d)
firstname();
middlename();
lastname();
?>
Parse error: syntax error, unexpected T_ELSE in C:\xampp\htdocs\php_exercise\exercise2_3.php on line 19
line 19: else echo "Middle name, what is that? ";
Why is it?