Q:

PHP - call class from class

Hello i looking for a way to call class function from another class.
i've tried diffrent PHP ways such as the classic way, to call class from class.
http://pastebin.com/X5VfaChr
require_once "user.php";
$user = new UserAction();
class htmloutput{
    public function WebSite(){
        $user->Moshe();
    }
}

Its shows me this error:" syntax error, unexpected 'new' (T_NEW), expecting function (T_FUNCTION)" i dont know about more ways to call a class.
I'll be happy to get helping and
learn somethin' from that.
Have Good day,
Baruch

A:

Try to get the instance inside your function, as the following:
require_once 'user.php';
class htmloutput {
    public function WebSite(){
        $user = new UserAction();
        $user->Moshe();
    }
}

