fork download
  1. <?php
  2.  
  3. class RandomDate {
  4. protected $date;
  5.  
  6. public function createRandomDate(int $year = 2007, int $mounth = 1, int $day = 1)
  7. {
  8. $randDate = strtotime(rand($year,2017).rand($mounth,12).rand($day,31));
  9. $this->date = date('Ymd', $randDate);
  10. return $this->date;
  11. }
  12. }
  13.  
  14. $obj = new RandomDate();
  15. echo $obj->createRandomDate(2015,5,25);
Success #stdin #stdout 0.01s 83904KB
stdin
Standard input is empty
stdout
20161027