In PHP, how do we return a large array?
<p>Say if this is the code:</p>

<pre><code>function bar() {
    $result = array();
    for ($i = 0; $i &lt; 1000; $i++) {
        $result[] = $i * 10;
    }
    return $result;
}

$ha = bar();
print_r($ha);
</code></pre>

<p>Is it not efficient to return a large array like that since it is "return by value"? (say if it is not 1000 but 1000000).  So to improve it, would we change the first line to:</p>

<pre><code>function &amp;bar() {
</code></pre>

<p>that is, just by adding an <code>&amp;</code> in front of the function name -- is this a correct and preferred way if a large array is returned?</p>
