public function between(\DateTime $start, \DateTime $end)
    {
        // Comparing DateTime also looks at the time. So we need to make sure the time is 0,
        // but don't modify the original referenced DateTime parameters
        $start = clone $start;
        $end = clone $end;
        $start->setTime(0, 0, 0);
        $end->setTime(0, 0, 0);

        $startyear = (int) $start->format("Y");
        $endyear   = (int) $end->format("Y");
        $holidays  = array();
        for ($y = $startyear; $y <= $endyear; $y++) {
            $holidays = array_merge($holidays, $this->getHolidays($y));
        }

        return array_filter($holidays,
            function(\DateTime $dt) use ($start, $end) {
                return $dt >= $start && $dt <= $end;
            });
    }
public function between(\DateTime $start, \DateTime $end)
    {
        // Comparing DateTime also looks at the time. So we need to make sure the time is 0,
        // but don't modify the original referenced DateTime parameters
        $start = clone $start;
        $end = clone $end;
        $start->setTime(0, 0, 0);
        $end->setTime(0, 0, 0);

        $startyear = (int) $start->format("Y");
        $endyear   = (int) $end->format("Y");
        $holidays  = array();
        for ($y = $startyear; $y <= $endyear; $y++) {
            $holidays = array_merge($holidays, $this->getHolidays($y));
        }

        return array_filter($holidays,
            function(\DateTime $dt) use ($start, $end) {
                return $dt >= $start && $dt <= $end;
            });
    }
public function between ( \ DateTime $ start , \ DateTime $ end ) { // Comparing DateTime also looks at the time. So we need to make sure the time is 0, // but don't modify the original referenced DateTime parameters $ start = clone $ start ; $ end = clone $ end ; $ start -> setTime ( 0 , 0 , 0 ) ; $ end -> setTime ( 0 , 0 , 0 ) ; $ startyear = ( int ) $ start -> format ( "Y" ) ; $ endyear = ( int ) $ end -> format ( "Y" ) ; $ holidays = array ( ) ; for ( $ y = $ startyear ; $ y <= $ endyear ; $ y ++ ) { $ holidays = array_merge ( $ holidays , $ this -> getHolidays ( $ y ) ) ; } return array_filter ( $ holidays , function ( \ DateTime $ dt ) use ( $ start , $ end ) { return $ dt >= $ start && $ dt <= $ end ; } ) ; }
Returns all holidays in the given time period.

@param \DateTime $start The start date
@param \DateTime $end   The end date

@return array
Returns all holidays in the given time period .