Order of Operations for echo statements
<p>Here's my code:</p>

<pre><code>&lt;?php
    class Test_Class {
        public function Show() {
            return "Test_Class-&gt;Show() function";
        }
    }

    class Test_Class2 {
        public function Show() {
            echo "Test_Class2-&gt;Show() function";
        }
    }

    $var1 = new Test_Class();
    $var2 = new Test_Class2();

    echo "var1 :: " . $var1-&gt;Show() . "&lt;br /&gt;";
    echo "var2 :: " . $var2-&gt;Show() . "&lt;br /&gt;";
?&gt;
</code></pre>

<p>Here's the output: </p>

<pre><code> var1 :: Test_Class-&gt;Show() function  
 Test_Class2-&gt;Show() functionvar2 :: 
</code></pre>

<p>You'll notice that the class that <strong>returns</strong> the string has the result appear where it normally would, whereas the class that <strong>echo's</strong> the string has the result appear before the echo statement that it is called in.</p>

<p>Now, I know that it's getting processed first, and that's why it's appearing first.  But how does this look at a lower level?</p>

<p>It is something along the lines of:<br>
.. parse<br>
.. parse<br>
.... Hey!  And echo statement, let's parse it!<br>
...... Hey!  inside this echo statement that we're parsing is an object's method, let's parse that now<br>
........ Inside this method there's an echo, so let's evaluate it
(output's inner echo statement)<br>
....We finished evaluating the echo statement (output outer echo statement)<br>
.. parse<br>
.. parse  </p>

<p>Is that close?</p>

<p>Anyone know the "order of operations" when it comes to this?</p>
