I'm trying to total the columns in a two-dimensional array without much success.
Array look like:
public 'fusWeek' => string '45' (length=2)
public 'Avg2012' => string '7.71' (length=4)
public 'Avg2013' => string '7.84' (length=4)
public 'Avg2014' => null
public 'Avg2015' => null
I'm using the following code to do the calculation but just keep getting zero as the total
$column = array_column($ary_table_data, 'Avg2012');
$totals = array_sum($column);
I know that the data in each column is a number but is held as a string, but was hoping PHP was clever enough to translate this.
Any other ideas or thoughts on how I can get this total to work out correctly.