Calling non-static method with call_user_func_array in PHP

前端 未结 1 1145
陌清茗
陌清茗 2021-01-20 06:30

I\'m trying to call an object\'s non-static method with call_user_func_array but I\'m not understanding how to formulate the callback. I\'ve found a lot of similar examples

1条回答
  •  清酒与你
    2021-01-20 07:09

    Use the notation [$objectHandle, "methodName"] to dynamically call a non-static method:

    call_user_func_array([$this,$method], $arguments);
    

    Live demo

    0 讨论(0)
提交回复
热议问题