
Untitled
By: a guest on
Apr 29th, 2012 | syntax:
None | size: 0.48 KB | hits: 15 | expires: Never
Pass variable to function, by value
function GetDateToReturn($StartDate)
{
$date = $StartDate;
return $date->modify('+2 day');
}
$FromDate = date_create('1-Feb-2012');
echo ' From : ' . $FromDate->format('Y-m-d); //From : 2012-02-01
$ToDate = $this->GetDateToReturn($FromDate);
echo ' From : ' . $FromDate->format('Y-m-d'); //From : 2012-02-03
echo ' To : ' . $ToDate->format('Y-m-d'); //To : 2012-02-03
$date = clone $StartDate;
return $date->modify('+2 day');