public function rangeHours($start, $end, $interval = 1, $select = true)
    {
        $tStart = strtotime($start);
        $tEnd = strtotime($end);
        $tNow = $tStart;

        $hours = [];
        while ($tNow <= $tEnd) {
            $hours[] = date("H:i", $tNow);
            $tNow = strtotime('+'.$interval.' hour', $tNow);
        }

        if ($select) {
            $hours = collect($hours)->map(function ($item) {
                return [
                    $item => $item
                ];
            })->collapse()->all();
        }

        return $hours;
    }
public function rangeHours($start, $end, $interval = 1, $select = true)
    {
        $tStart = strtotime($start);
        $tEnd = strtotime($end);
        $tNow = $tStart;

        $hours = [];
        while ($tNow <= $tEnd) {
            $hours[] = date("H:i", $tNow);
            $tNow = strtotime('+'.$interval.' hour', $tNow);
        }

        if ($select) {
            $hours = collect($hours)->map(function ($item) {
                return [
                    $item => $item
                ];
            })->collapse()->all();
        }

        return $hours;
    }
public function rangeHours ( $ start , $ end , $ interval = 1 , $ select = true ) { $ tStart = strtotime ( $ start ) ; $ tEnd = strtotime ( $ end ) ; $ tNow = $ tStart ; $ hours = [ ] ; while ( $ tNow <= $ tEnd ) { $ hours [ ] = date ( "H:i" , $ tNow ) ; $ tNow = strtotime ( '+' . $ interval . ' hour' , $ tNow ) ; } if ( $ select ) { $ hours = collect ( $ hours ) -> map ( function ( $ item ) { return [ $ item => $ item ] ; } ) -> collapse ( ) -> all ( ) ; } return $ hours ; }
Interval between two hours
@param  string  $start    01:00:00
@param  string  $end      23:00:00
@param  integer $interval Interval in hours
@param  boolean $select   For use in select of a form or array only
@return array
Interval between two hours