根据PHP文档的价值。
默认情况下,函数参数是按值传递的(因此,如果函数中参数的值发生更改,则不会在函数外部进行更改)。要允许函数修改其参数,必须通过引用将其传递。
有一个参数总是通过引用传递函数,在前面加上符号( & ),以在函数定义的参数名称。
<?phpfunction add_some_extra(&$string){ $string .= 'and something extra.';}$str = 'This is a string, ';add_some_extra($str);echo $str; // outputs 'This is a string, and something extra.'?>


