Pass by Value and Pass by reference in php

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.


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


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.

链接地址: http://www.djcxy.com/p/20620.html

上一篇: 值通过参数VS. 通过

下一篇: 通过值传递和在PHP中传递引用