Grouping array with consecutive keys
<p>I've an array like this -</p>

<pre><code> Array
(
    [16] =&gt; 424
    [17] =&gt; 404
    [18] =&gt; 416
    [21] =&gt; 404
    [22] =&gt; 456
    [23] =&gt; 879
    [28] =&gt; 456
    [29] =&gt; 456
    [32] =&gt; 123
    [35] =&gt; 465
)
</code></pre>

<p>The output of this array would be</p>

<pre><code>Array
(
    [0] =&gt; Array
           (   ['start'] =&gt; 16
               ['stop'] =&gt; 19
           )
    [1] =&gt; Array
           (   ['start'] =&gt; 21
               ['stop'] =&gt; 24
           )
    [2] =&gt; Array
           (
               ['start'] =&gt; 28
               ['stop'] =&gt; 30
           )
    [3] =&gt; Array
           (
               ['start'] =&gt; 32
               ['stop'] =&gt; 33
           )
    [4] =&gt; Array
           (
               ['start'] =&gt; 35
               ['stop'] =&gt; 36
           )
)
</code></pre>

<p>I don't really need the values. Just grouping the keys.</p>

<p>The 'start' value should be the 'start' value itself. Whereas, the 'stop' value should be a consecutive integer.</p>

<p>And if consecutive integer doesn't exist for a particular key(like for [32] and [35]), 'stop' should be the integer+1 (same as above) .</p>

<p>Thank you all for help.</p>
