How can i copy an object?
<p>I'm really stuck with references in php. In my programm i've got something similiar to this:</p>

<ol>
<li><p>Programm</p>

<pre><code>class Test
{
    private $_property;

    function __construct($property)
    {
        $this-&gt;_property = $property;
    }

    public function setProperty($property)
    {
        $this-&gt;_property = $property;
    }

    public function getProperty()
    {
        return $this-&gt;_property;
    }
}

function doSmth(Test $var)
{
    $newVar = new Test('test');

    //I need to do something here...
}

$var = new Test('original');

doSmth($var);

var_dump($var);
</code></pre></li>
<li><p>Question</p></li>
</ol>

<p>What should i do to copy all contents of <code>$newVar</code> variable to my <code>$var</code> variable so that i will be able to see it after using <code>var_dump()</code> function that is outside of function <code>doSmth()</code>. And i can't use getters and setters in my programm because i've got a lot of them and it will be a lot of code. Is it possible to solve this problem with my limitations?</p>

<p><strong>UPDATE</strong>: I can't return value in my function <code>doSmth()</code> and i also tried <code>__clone</code> but nothing works. Can someone show me how can i do it with <code>__clone()</code>?</p>
