How to calculate FPDF column heights to minimize vertical space

I've searched and cannot find anything at all related to my problem. I assume this would be a common problem for coders working in layout formats (like PDF).

Here's my problem. I am producing PDF files in FPDF using PHP 7.x and need to maximize the use of vertical space on the resulting page by making multiple columns approximately the same length. Given a single array of arrays of varying length, I need to produce an array containing X columns of elements properly reordered so that I can use the resulting array to add the columns to the PDF. The trick is to order them in such a way that all columns end up being as close to the same length as possible.

Here is my array:

<?php
$array = [
    'Section A Title' => 
        [
            'Footing',
            'Framing',
            'Electrical Rough',
            'Electrical Finish',
            'Plumbing Rough',
            'Final Inspection'
        ],
    'Section B Title' =>
        [
            'Floor/Interior',
            'Concrete flatwork preparation'
        ],
    'Section C Title' =>
        [
            'Building',
            'Zoning',
            'Road Access'
        ],
    'Section D Title' =>
        [
            'Private utility lines identified and marked',
            'Site Preparation (pre-construction)',
            'Purchase of (pre-construction) fill material',
            'Obstruction removal',
            'Termite pre-treatment',
            'Final/Finish grading',
            'Dumpster/Trash removal',
            'Utility line marking/digging clearance'
        ],
    'Section E Title' =>
        [
            'Temporary electrical service',
            'Permanent electrical rough-in/hookup',
            'Gas service rough-in/hookup'
        ]
];

If two columns are desired, then the resulting array would look like the following (note that column 0 results in 14 lines and column 1 has 13 lines):

<?php

$result = [
    '0' => //Column 1
        ['Section A Title' => 
            [
                'Footing',
                'Framing',
                'Electrical Rough',
                'Electrical Finish',
                'Plumbing Rough',
                'Final Inspection'
            ],
        ['Section B Title' =>
            [
                'Floor/Interior',
                'Concrete flatwork preparation'
            ],
        ['Section C Title' =>
            [
                'Building',
                'Zoning',
                'Road Access'
            ]
        ],
    '1' => //Column 2
        ['Section D Title' =>
            [
                'Private utility lines identified and marked',
                'Site Preparation (pre-construction)',
                'Purchase of (pre-construction) fill material',
                'Obstruction removal',
                'Termite pre-treatment',
                'Final/Finish grading',
                'Dumpster/Trash removal',
                'Utility line marking/digging clearance'
            ],
        ['Section E Title' =>
            [
                'Temporary electrical service',
                'Permanent electrical rough-in/hookup',
                'Gas service rough-in/hookup'
            ]
        ]
];