PHP Call-time pass-by-reference unavoidable?

前端 未结 2 512
醉话见心
醉话见心 2021-01-20 23:04

Given the following interface:

interface ISoapInterface {
  public static function registerSoapTypes( &$wsdl );
  public static function registerSoapOperatio         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-20 23:51

    While call_user_func does not pass parameters by reference, call_user_func_array can.

    $callback = array($provider, 'blahblahblah');
    call_user_func_array($callback, array( &$server ));
    

    The only real difference is that it expects an array of parameters instead of a list of parameters like call_user_func (similar to the difference between sprintf and vsprintf)...

提交回复
热议问题