Using constructor and a public function in a class
<p>I tried to create a basic class with a function. Once an instance of the class is created <code>new BaseClass("hello")</code> then the constructor function saves the parameter to a variable.
The <code>-&gt;ret_text()</code> should return with this variable, but it doesn't works. The error is: <code>unexpected T_OBJECT_OPERATOR</code></p>

<pre><code>class BaseClass {
    var $txt;

    function __construct($text) {
        $txt = $text;
    }

    public function ret_text() {
        return $txt;
    }
}

echo (new BaseClass("hello"))-&gt;ret_text();
</code></pre>
