Say if this is the code:
function bar() { $result = array(); for ($i = 0; $i < 1000; $i++) { $result[] = $i * 10; } return $result; } $ha = bar(); print_r($ha);
Is it inefficient to return such a large array as it "returns a value"? (say, if it is not 1,000, but 1,000,000). To improve it, will we change the first line to:
function &bar() {
that is, simply adding &
in front of the function name is the correct and preferred way if a large array is returned?
source share