fork download
  1. <?php
  2. $data_original = '2015-05-01';
  3.  
  4. $dataVencimento = new DateTime($data_original);
  5. $dataVencimento->add(new DateInterval('P5D'));
  6.  
  7. echo 'Data original: '. $data_original .PHP_EOL;
  8. echo 'DateTime & DateInterval: '. $dataVencimento->format('Y-m-d') .PHP_EOL;
  9. echo 'Date & strtotime: '. date('Y-m-d', strtotime($data_original .'+ 5days'));
  10.  
Success #stdin #stdout 0.02s 24448KB
stdin
Standard input is empty
stdout
Data original: 2015-05-01
DateTime & DateInterval: 2015-05-06
Date & strtotime: 2015-05-06