How to call a function from inside class to outside class

Remove the () after myclass. Then in your myfunction2:

$obj = new myclass();
$obj->myfunction();