I am trying to reutrn a class from a function and access it out. It is not working.
What do I need to do? Thanks in advance.
Here is the code
<?php class classa { public function foo () { return 'bar'; } } class classb { public static function getmodela () { $model = new modela(); return model; } } $m = new classb(); $n = $m->getclassa(); $o = $n->foo(); print $o; ?>
and here is the error I get
Fatal error: Call to a member function foo() on a non-object in C:\php\examples\b.php on line 18