unpacking an array of arguments in php

后端 未结 5 1985
醉话见心
醉话见心 2020-12-15 04:11

Python provides the \"*\" operator for unpacking a list of tuples and giving them to a function as arguments, like so:

args = [3, 6]
range(*args)                     


        
5条回答
  •  温柔的废话
    2020-12-15 04:47

    You should use the call_user_func_array

    call_user_func_array(array(CLASS, METHOD), array(arg1, arg2, ....))
    

    http://www.php.net/call_user_func_array

    or use the reflection api http://www.php.net/oop5.reflection

提交回复
热议问题