I'd suggest creating a new .php file, with these contents:
<?php phpinfo(); ?>
and running it on your server. (you may have already done this in a previous lesson, but I'm not sure if Stefan covered that). If you have PHP 4, you won't be able to use "__construct", since that is PHP5 only.
If you are using a program like WAMP or MAMP to run a server on your local machine, chances are, you probably have PHP5. If you are running this on a live server, it is possible that your host hasn't upgraded to PHP5 yet.
If you are using PHP4, you can still use OOP, you just have to use a slightly different constructor. Instead of using "__construct", your constructor method will have the same name as the class (in this case, your constructor will be person()):
<?php
class person {
var $name;
function person($persons_name) { <-- constructor
$this->name = $persons_name;
}
function set_name($new_name) {
$this->name = $new_name;
}
function get_name() {
return $this->name;
}
}
?>
If you are running PHP5, and the "__construct" itself isn't a problem, post the code you are working with -- perhaps you have some sort of error that I will be able to catch.
Benjamin Falk |
Falken Creative :
TwitterSkills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter