difference between function and &function
本问题已经有最佳答案,请猛点这里访问。
1 2 | function fun1(); function &fun1(); |
这些有什么区别??
如果在函数名之前加上一个和号,函数将返回对变量的引用,而不是对值的引用。
Returning by reference is useful when you want to use a function to
find to which variable a reference should be bound. Do not use
return-by-reference to increase performance. The engine will
automatically optimize this on its own. Only return references when
you have a valid technical reason to do so.
关于返回引用的PHP手册。
不同之处在于返回值的方式:如果没有
后者意味着您需要在