php - passing updated value of variable between functions inside of a class
<p>I was under the impression that the following concept would work, but the new value of $foo isn't passed between functions.  What is the correct way to do this?</p>

<pre><code>class doSomething
{

    public $foo = "good";

    public function changeFooAgain()
    {
        $this-&gt;foo = "best";
    }

    public function changeFoo()
    {
        $this-&gt;foo = "better";

    }   

    public function getFoo()
    {
        $this-&gt;changeFoo();
        $this-&gt;changeFooAgain();

        return $this-&gt;foo;
    }


}

$foo = new doSomething;

print $foo-&gt;getFoo();
</code></pre>
