Merge two (or more) arrays and keep values that are highest?
问题 I've got a permissions/group based setup that I'm trying to merge results on. For example, a user might be associated with four groups: | username | passwd | email | groups | | test_user | 9agb9 | test@test.com | g1, g2, g3, g4 | grouping table: | group | perm1 | perm2 | perm3 | perm4 | perm5 | perm5 | perm7 | | g1 | 1 | 0 | 0 | 0 | 1 | 0 | 2 | | g2 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | | g3 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | | g4 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | I'm looking to take the results of those four