For you php experts who know arrays and sorting really well, I could use some suggestions on this.
I need to have an array containing the following data:
MemberNumber
LastName
FirstName
Role
Date (mysql format for sorting)
FormattedDate (for printing)
Not all members will have all roles or dates and vice versa.
From this, I need to be able to produce another array as a matrix that I can print from containing all the members, roles and dates that appear in the first array. The matrix must be sortable by any of LastName, Date, Role, and must contain in all the positions that don't have a value from the first array. I have to maintain the relationship among the elements in the array.
In other words, I need to produce a matrix that can be printed with any of the LastName, FormattedDate, or Role as the column header, row header, and value. Six possible print cases -- for example, case 1 would be FirstName/LastName across the top, FormattedDate down the left, and Role in the matrix cells, and the other 5 cases similar with different choices. In each case, I need to sort by the underlying value of the column header and row header (that is sorted by Date, not FormattedDate, and by LastName).
What is the best way to set up this array and what sort function(s) will allow me to sort it by row and column selection based on a php variable?
Start Free Trial