get every 4th hour
<p>I have a time string from 0 to 24. like this</p>

<pre><code>0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
</code></pre>

<p>Now if it is 2 oclock, I want to select every 4th hour. so from above it will be</p>

<pre><code>2, 6, 10, 14, 18, 22
</code></pre>

<p>I am trying to wrap my head around it to get this going
thanks</p>

<p>I have tried this</p>

<pre><code>if(range($hour, 23, 4)){
    print_r($hour);echo '&lt;br /&gt;'; 
}
</code></pre>

<p>but it still prints all the hours in that array</p>

<p><strong>EDIT</strong>
here is the code </p>

<p><code>$hourlyData-&gt;hour</code> is just an hour digit, like 0 or 1 or 2 etc upto 23</p>

<pre><code>foreach($jason-&gt;hours as $hourlyData){
    if(range($hourlyData-&gt;hour, 23, 3)){
        // print here to check if the correct time is used
        print_r($hourlyData-&gt;hour);echo '&lt;br /&gt;'; 
    }
}
</code></pre>
