I’ve got the following code:
class the_class {
private the_field;
function the_class() {
the_field = new other_class(); //has other_method()
}
function method() {
$this->the_field->other_method(); //This doesn't seem to work
}
}
Is there anything wrong with the syntax here? The method call always seems to return true, as if there is something wrong with the method call.
Or is the method call all right and I should debug the other_method() itself?
TIA, Peter
You have missed PHP Variable notation and Class Property Access:
$symbol is must for each PHPvariable ( not CONSTANT ).
$thiskeyword/self variable is must to access current class or parent class member. In some cases you may/have to use ‘self’ or ‘parent’ keyword specially for static member.