protected function incrementHeaders(array $headers)
    {
        $incrementedHeaders = [];
        foreach (array_count_values($headers) as $header => $count) {
            if ($count > 1) {
                $incrementedHeaders[] = $header;
                for ($i = 1; $i < $count; $i++) {
                    $incrementedHeaders[] = $header . $i;
                }
            } else {
                $incrementedHeaders[] = $header;
            }
        }

        return $incrementedHeaders;
    }
protected function incrementHeaders(array $headers)
    {
        $incrementedHeaders = [];
        foreach (array_count_values($headers) as $header => $count) {
            if ($count > 1) {
                $incrementedHeaders[] = $header;
                for ($i = 1; $i < $count; $i++) {
                    $incrementedHeaders[] = $header . $i;
                }
            } else {
                $incrementedHeaders[] = $header;
            }
        }

        return $incrementedHeaders;
    }
protected function incrementHeaders ( array $ headers ) { $ incrementedHeaders = [ ] ; foreach ( array_count_values ( $ headers ) as $ header => $ count ) { if ( $ count > 1 ) { $ incrementedHeaders [ ] = $ header ; for ( $ i = 1 ; $ i < $ count ; $ i ++ ) { $ incrementedHeaders [ ] = $ header . $ i ; } } else { $ incrementedHeaders [ ] = $ header ; } } return $ incrementedHeaders ; }
Add an increment to duplicate headers

So the following line:
|duplicate|duplicate|duplicate|
|first    |second   |third    |

Yields value:
$duplicate => 'first', $duplicate1 => 'second', $duplicate2 => 'third'

@param array $headers

@return array
Add an increment to duplicate headers