Ok the problem I am having is difficult to explain. I'm working on a project for work and I am allowing people to upload a variable number of tables (up to 5 maybe 10 later). Then I am taking the uploaded tables and normalizing them (I'm fairly sure all the code written here does what I want).
Ok to store the normalized tables, since there is a variable number, I use a 3 dimensional array such as $data[$a][$r][$c] where $a=array number (because all the normalized uploaded tables are stored here), $r=row number, and $c=column number. The normalized tables contain row names and column names also.
Now to the hard part: Next i need to create one table that is all the separate tables merged into one. If more than one table has overlapping data (a value with matching column AND row name) the value of the overlapping data from each table needs to be averaged. If one of the values is zero it is not included in the average. Also, if there is a column without matching data for a row or a row without matching data for a column then the blank is filled with a 0.
....1...2 (ignore the periods, just used to line the column names up)
a 93 87
b 73 27
a 10 90
c 35 21
a 93 50 90
b 73 27 0
c 0...35 21
Please help before I lose my mind trying to figure out how to do this
P.S. the column names and row names are not this simple in my actual tables, they are more like HK/12/93/76 and such
P.S.S. I'm open to any suggestions on how to implement this.