I need to be able to call a function, but the function name is stored in a variable, is this possible? e.g:
function foo () { //code here } function bar () {
Following code can help to write dynamic function in PHP. now the function name can be dynamically change by variable '$current_page'.
$current_page = 'home_page'; $function = @${$current_page . '_page_versions'}; $function = function() { echo 'current page'; }; $function();