Pass variable to function, by value
<p>I have a php function to add number of days to input date   </p>

<pre><code>function GetDateToReturn($StartDate)
{
    $date = $StartDate;
    return $date-&gt;modify('+2 day');
}
</code></pre>

<p>When I call above function</p>

<pre><code>$FromDate = date_create('1-Feb-2012');
echo ' From : ' . $FromDate-&gt;format('Y-m-d); //From : 2012-02-01
$ToDate = $this-&gt;GetDateToReturn($FromDate);    
echo ' From : ' . $FromDate-&gt;format('Y-m-d'); //From : 2012-02-03
echo ' To : ' . $ToDate-&gt;format('Y-m-d'); //To : 2012-02-03
</code></pre>

<p>It also changes the value of the input variable? </p>

<p>How to retain the FromDate variable value and get new date to ToDate variable?</p>
