let's say i have a set of features like
article() - displays the articlemenu() - menu
etc.
Sometimes I may only need to get the output of such functions, and not print it on the screen. Therefore, instead of creating another set of functions that return type values get_article(), get_menu()etc., can I make one function that does this using output buffering and call_user_func?
eg,
function get($function_name){
ob_start();
call_user_func($function_name);
return ob_get_contents();
}
The problem in my code is that I don’t know how to pass arguments $function_name. A function may require any number of arguments ...
source
share