I have a pair of 2D arrays corresponding to a set of records from a database.
One array contains the current records, the other contains the new records.
I would like an elegant generic solution to sort these arrays so that I know which of the new records to INSERT or UPDATE, and which of the current records to DELETE. I'm sure this must be common behaviour, but an answer that doesn't require lots of nested array looping escapes me.
I think ideally a 2D array intersection would get the UPDATE records, and a 2D array_diff the INSERT / DELETE records.