Custom fields array to display it monthly

This question is better suited at https://stackoverflow.com as Max suggested, but for a quick and dirty solution:

Solution (rough)

Adjust the code to suit your specifications but this should give you the basic structure you need.

<?php

// assume $meta_data holds your array (e.g. get_post_meta($post_id, 'some_key', true);
// for some sample data I made an array here: https://pastebin.com/8qgabnAM

$headings = ['<th class="empty"></th>'];

$rows = [];

foreach ($meta_data  as $key => $months) {

    $heading = str_replace('webw_employee_', '', $key);
    $heading = implode( ' ', explode('_', $heading) );
    $heading = ucwords( $heading );

    $headings[] = "<th>{$heading}</th>";

    foreach ($months  as $month => $value) {
        $rows[$month][$key] = "<td>{$value}</td>";
    }  
}  

foreach ($rows  as $month => $row) {

    $heading = "<th>{$month}</th>";
    $cells   = implode('', $row);

    $rows[$month] = "<tr>{$heading}{$cells}</tr>";

} 

$rows = implode( '', $rows );
$headings = implode( '', $headings );
$headings = "<tr>{$headings}</tr>";
?>

<table>
    <tbody>
    <?php echo $headings ?>
    <?php echo $rows ?>
    </tbody>
</table>

Result:

Note sample data is random, obviously will be different for your dataset, this was just to show how the table populates.

You can easily adjust this to break each month into it’s own table if you require.

enter image description here

Result #2: (with computed meta_keys)

Regarding comment:

I need to add some values to the dataset, but whatever I do it gives me 0, let’s say I want to add the salary + extra payment it gives me 0 even if I cast it to float or int, what do you think the issue? ibb.co/C2tt6QV

Please refer to GIST HERE

enter image description here