PHP call_user_func vs. just calling function

前端 未结 8 1591
我寻月下人不归
我寻月下人不归 2020-12-04 08:06

I\'m sure there\'s a very easy explanation for this. What is the difference between this:

function barber($type){
    echo \"You wanted a $type haircut, no         


        
8条回答
  •  臣服心动
    2020-12-04 08:56

    in your first example you're using function name which is a string. it might come from outside or be determined on the fly. that is, you don't know what function will need to be run at the moment of the code creation.

提交回复
热议问题