What does “&” mean here in PHP?

后端 未结 3 1583
情书的邮戳
情书的邮戳 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:04

    From the Passing By Reference docs page:

    You can pass a variable by reference to a function so the function can modify the variable. The syntax is as follows:

    
    

    ...In recent versions of PHP you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);

提交回复
热议问题