Hi I'm trying to get this work
if ( class_exists($object1->controller) ){
$object2 = new $object1->controller();
if (method_exists($object2,$object1->method)){
$object2->$object1->method();
} elseif (method_exists($object2,'index')){
$object2->index();
} else { .... }
} else { ... }
however it gives me this error
Object of class ... could not be converted to string
So if I change the code to
$astring = $object1->method;
if ( class_exists($object1->controller) ){
$object2 = new $object1->controller();
if (method_exists($object2,$object1->method)){
$object2->$astring();
} elseif (method_exists($object2,'index')){
$object2->index();
} else { .... }
} else { ... }
it works but what I'm want to know is; is it possible make it work with having to do this?
$astring = $object1->method;