কম্পিউটার

পিএইচপি-তে একটি অ্যারেতে দুটি তারিখের মধ্যে সমস্ত তারিখ ফেরত দিন


দুটি তারিখের মধ্যে সমস্ত তারিখ ফেরত দিতে, কোডটি নিম্নরূপ -

উদাহরণ

<?php
   function displayDates($date1, $date2, $format = 'd-m-Y' ) {
      $dates = array();
      $current = strtotime($date1);
      $date2 = strtotime($date2);
      $stepVal = '+1 day';
      while( $current <= $date2 ) {
         $dates[] = date($format, $current);
         $current = strtotime($stepVal, $current);
      }
      return $dates;
   }
   $date = displayDates('2019-11-10', '2019-11-20');
   var_dump($date);
?>

আউটপুট

এটি নিম্নলিখিত আউটপুট-

তৈরি করবে
array(11) {
   [0]=>
   string(10) "10-11-2019"
   [1]=>
   string(10) "11-11-2019"
   [2]=>
   string(10) "12-11-2019"
   [3]=>
   string(10) "13-11-2019"
   [4]=>
   string(10) "14-11-2019"
   [5]=>
   string(10) "15-11-2019"
   [6]=>
   string(10) "16-11-2019"
   [7]=>
   string(10) "17-11-2019"
   [8]=>
   string(10) "18-11-2019"
   [9]=>
   string(10) "19-11-2019"
   [10]=>
   string(10) "20-11-2019" 
}

  1. PHP-তে explode() ফাংশন কি?

  2. পিএইচপি-তে দুটি স্ট্রিংয়ের সংমিশ্রণ

  3. PHP - mb_list_encodings() সহ সমস্ত সমর্থিত এনকোডিংগুলির একটি অ্যারে ফেরত দিন

  4. কিভাবে Excel এ দুটি তারিখের মধ্যে সমস্ত তারিখ বের করে তালিকাভুক্ত করবেন