What is the main difference between the following statements?
<p>Recently i was studying the "Passing by Reference", I come to know following ways</p>

<p>What is the main difference between the following methods.</p>

<p>1.</p>

<pre><code>function foo(&amp;$var)
{
    $var++;
}

$a=5;
foo($a);
</code></pre>

<p>2.</p>

<pre><code>function foo($var)
{
    $var++;
}

$a=5;
foo(&amp;$a);
</code></pre>

<p>3.</p>

<pre><code>function foo(&amp;$var)
{
    $var++;
}
function &amp;bar()
{
    $a = 5;
    return $a;
}
foo(bar());
</code></pre>

<p>even though all of them produce same results, and which is the best way to work with.</p>

<p>Thanks. </p>
