1

Possible Duplicates:
When to pass-by-reference in PHP
What's the difference between passing by reference vs. passing by value?

In PHP by default we have pass by value.I am wondering what would be good situations for passing values by reference.

Community
  • 1
  • 1
Aditya Shukla
  • 13,595
  • 12
  • 38
  • 36
  • i think this is a duplicate http://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value – KJYe.Name Dec 22 '10 at 16:38

2 Answers2

1

If you want to "return" more than one variable it's helpful. Functions like preg_match use it.

Parris Varney
  • 11,320
  • 12
  • 47
  • 76
-1

Populating a Combobox, for example.

Doing something with a control, or an object in the main scope, but from another layer.

Fetching data from your data layer, and populating a ComboBox, by reference, instead of retrieving a list of values in the main scope (page) and populating the ComboBox there.

Smur
  • 3,075
  • 7
  • 28
  • 46