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
Post a Comment