PHP arrays and pass-by-reference
<p>The following pattern used to be possible in PHP:</p>

<pre><code>function foo($arr)
{
    // modify $arr in some way
    return $arr;
}
</code></pre>

<p>This could then be called using pass-by-value:</p>

<pre><code>$arr = array(1, 2, 3);
$newarr = foo($arr);
</code></pre>

<p>or pass-by-reference:</p>

<pre><code>$arr = array(1, 2, 3);
foo(&amp;$arr);
</code></pre>

<p>but "Call-time pass-by-reference has been deprecated". Modifying the function signature:</p>

<pre><code>function foo(&amp;$arr)
</code></pre>

<p>will handle the pass-by-reference case, but will break the dual-purpose nature of the original function, since pass-by-value is no longer possible.</p>

<p>Is there any way around this?</p>
