3

I am Studying PHP, and i wanted to ask about references,

My question: What is the difference when you define function with (&) and when you call function with (&) same is for parameters, In other words what the difference when i put (&) at the definition between when i call the function/parameter with (&), thank you all and have a nice day.

Blanktext
  • 1,383
  • 2
  • 11
  • 16

1 Answers1

2

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. To return references, use this syntax:

From the PHP manual Returning References

bretterer
  • 5,498
  • 5
  • 30
  • 52