php - Writing function name as the value of a string variable -


i have string variable

$worker_name = "video_convert" 

i want write function name following

function video_convert(){ } 

how can in php? tried

function eval($worker_name){ } 

or

eval($worker_name) = function(){ } 

but, seems not correct way in php.

you can as

$worker_name = 'video_convert'; $$worker_name = function() {    echo 'hi'; }; $$worker_name(); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -