Hi. I am new to PHP. I am using PHP 4.3.8. I have a class called form_object and a class called errors. form_object instantiates an instance of errors. I am trying to access functions in the errors class through the form_object object. Here are trimmed down versions of my code.
form_object.inc
include "errors.inc";
class form_object {
var $errors;
function form_object() {
$this->errors = new errors();
}
function get_errors_object() {
return $this->errors;
}
}
errors.inc
class errors {
var $messages;
function errors() {
$this->messages = array();
}
function add_message($message) {
$this->messages[] = $message;
}
}
test.php
include "../classes/form_object.inc";
$my_object = new form_object();
$my_object->get_error_object()->add_message("This is an error message.");
I get:
Parse error: parse error, unexpected T_OBJECT_OPERATOR
Can anyone help me out? Thanks.