Advertisement
Guest User

Sale

a guest
Aug 21st, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php
  2.  
  3. $period = 5;
  4.  
  5. function ex($period)
  6. {
  7.     $daysInMonth = date('t');
  8.    
  9.     $daysOfEx = [$daysInMonth];
  10.    
  11.     for($i = $daysInMonth - 1; $i > 0; $i --) {
  12.         if($i % $period == 0 && $daysInMonth - $i >= $period) {
  13.             $daysOfEx[] = $i;  
  14.         }
  15.     }
  16.    
  17.     return $daysOfEx;
  18. }
  19.  
  20. print_r(ex(5));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement