PHP call_user_func vs. just calling function

前端 未结 8 1593
我寻月下人不归
我寻月下人不归 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:40

    With PHP 7 you can use the nicer variable-function syntax everywhere. It works with static/instance functions, and it can take an array of parameters. More info at https://trowski.com/2015/06/20/php-callable-paradox

    $ret = $callable(...$params);
    

提交回复
热议问题