Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.48 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Pass variable to function, by value
  2. function GetDateToReturn($StartDate)
  3. {
  4.     $date = $StartDate;
  5.     return $date->modify('+2 day');
  6. }
  7.        
  8. $FromDate = date_create('1-Feb-2012');
  9. echo ' From : ' . $FromDate->format('Y-m-d); //From : 2012-02-01
  10. $ToDate = $this->GetDateToReturn($FromDate);    
  11. echo ' From : ' . $FromDate->format('Y-m-d'); //From : 2012-02-03
  12. echo ' To : ' . $ToDate->format('Y-m-d'); //To : 2012-02-03
  13.        
  14. $date = clone $StartDate;
  15. return $date->modify('+2 day');