What does “&” mean here in PHP?

后端 未结 3 1586
情书的邮戳
情书的邮戳 2020-12-07 00:47

Consider this PHP code:

call_user_func(array(&$this, \'method_name\'), $args);

I know it means pass-by-reference when defining function

3条回答
  •  一整个雨季
    2020-12-07 01:14

    call_user_func(array(&$this, 'method_name'), $args);
    

    This code generating Notice: Notice: Undefined variable: this

    Here is a correct example:

    
    The above example will output:
    
    0
    1
    

提交回复
热议问题