hours range and resetting the hours on the new day
<p>I have the following code </p>

<pre><code>$date = new DateTime($json-&gt;date);
$hour =  $date-&gt;format( 'H' );  
$range = range($hour, 23, 3); // get the range for the data to be provided;
        foreach($json-&gt;hourly as $hourlyData){

            if(in_array($hourlyData-&gt;hour, $range)){

                print_r($hourlyData-&gt;hour);echo '&lt;br /&gt;'; 
            }
        }
</code></pre>

<p>the code above looks at current time. If time is 4, then it will add an echo for every 3 hours as the range would be (4,23, 3). This all is good. However, this above is only for current day. But for next day, I want the range to be reset and instead of from 4, it will be from 1 till 23. So the range will reset to (1,23,3) and so on. </p>
