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

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -