protected function getRanges(array $values)
	{
		$i      = 0;
		$cnt    = count($values);
		$start  = $values[0];
		$end    = $start;
		$ranges = [];
		while (++$i < $cnt)
		{
			if ($values[$i] === $end + 1)
			{
				++$end;
			}
			else
			{
				$ranges[] = [$start, $end];
				$start = $end = $values[$i];
			}
		}
		$ranges[] = [$start, $end];

		return $ranges;
	}
protected function getRanges(array $values)
	{
		$i      = 0;
		$cnt    = count($values);
		$start  = $values[0];
		$end    = $start;
		$ranges = [];
		while (++$i < $cnt)
		{
			if ($values[$i] === $end + 1)
			{
				++$end;
			}
			else
			{
				$ranges[] = [$start, $end];
				$start = $end = $values[$i];
			}
		}
		$ranges[] = [$start, $end];

		return $ranges;
	}
protected function getRanges ( array $ values ) { $ i = 0 ; $ cnt = count ( $ values ) ; $ start = $ values [ 0 ] ; $ end = $ start ; $ ranges = [ ] ; while ( ++ $ i < $ cnt ) { if ( $ values [ $ i ] === $ end + 1 ) { ++ $ end ; } else { $ ranges [ ] = [ $ start , $ end ] ; $ start = $ end = $ values [ $ i ] ; } } $ ranges [ ] = [ $ start , $ end ] ; return $ ranges ; }
Get the list of ranges that cover all given values

@param  integer[] $values Ordered list of values
@return array[]           List of ranges in the form [start, end]
Get the list of ranges that cover all given values