php - Call objects in array values -


i set array variable this:

$app = [    "page" => function(){     echo "ok";   },    "test" => function(){     testfunc();   },  ]; 

now, want know how can call or run objects in array,

i trying use eval($app['test']) not work!

you can use call_user_func()

ie.

call_user_func($app['page']); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -