call non-static class method with dynamic class name -
right i'm solving problem this:
switch($action) { case "get": if("sections" == $table){ echo $get->nested(); } else { echo $get->elements(); } break; case "upd": if("sections" == $table){ echo $upd->nested(); } else { echo $upd->elements(); } break; }
but there must more 'elegant' way right?!
if("sections" == $table) call_user_func(array(ucfirst($action), 'nested')); else call_user_func(array(ucfirst($action), 'elements'));
is not working. how solve that?
Comments
Post a Comment