I'm just starting to learn OO php after realising that it's what I need to go into contracting properly.
I think I understand the concepts but get an error Parse error: syntax error, unexpected T_NEW in C:\xampp\htdocs\ooprogramming\mainpage.php on line 13
Doesn't seem to be anything different to the example, it's a bit puzzling?
Thanks,
################## Mainpage.php #########################################
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<?php
include ("class_lib.inc");
$stefan new person("stefan mishook");
echo "stefs full name is " . $stefan->get_name();
?>
</body>
</html>
############# class #########################################
<?php
class person
{
var $name;
function __construct($persons_name)
{
$this->name = $persons_name;
}
function set_name($new_name)
{
$this->name = $new_name;
}
function get_name()
{
return $this->name;
}
}
class employee extends person
{
function __construct($employeename) {
$this->set_name($employee_name) ;
}
}