gavin@intomusic.co.uk Posted March 4, 2011 Report Posted March 4, 2011 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) ; } } Quote
BeeDev Posted March 4, 2011 Report Posted March 4, 2011 (edited) $stefan = new person("stefan mishook"); EQUALS SIGN Syntax Error = Typo Edited March 4, 2011 by BeeDev Quote
gavin@intomusic.co.uk Posted March 7, 2011 Author Report Posted March 7, 2011 $stefan = new person("stefan mishook"); EQUALS SIGN Syntax Error = Typo Thanks BeeDev, always the simple things... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.