Can someone help me out here: executing this code returns an error: Call to a member function on a non-object
How do i do this? Basically, instantiate a class... this class's constructor instantiates another class, into a variable, and I want to be able to return that instance of the 2nd class through the variable.
class a{
var $sub;
function a(){
$sub= new b;
}
function get_sub(){return $this->sub;}
}
class b{
var $myval;
function b(){
$this->myval = "value here";
}
function get_myval(){return $this->myval;}
}
$test = new a();
$test2 = $test->get_sub();
echo("TEST..." . $test2->get_myval());
dankee,
rdrnnr