class MyClass{As soon as the
private $myObject;
public function MyClass(){
$myObject = new MyObject()
}
}
$myObject
variable is accessed the following error is thrown: Call to a member function on a non-object. What?????
This is PHP not Java nimrod. :)
$myObject
is not getting initialized because the syntax is incorrect. Try this:class MyClass{That should fix it right up. This sort of stuff always happens to me as I bounce between languages. lol.
private $myObject;
public function MyClass(){
$this->myObject = new MyObject()
}
}
No comments:
Post a Comment