Determine whether the arrays are the same based on multiple keys
In the same row, each value is added
This is my idea, splice the keys together as one key, and then you can judge based on only one key? Do you have any other methods?
<?php
$test = [
[
'name' : 'a',
'age' : 12,
'number' : 11,
'score' : 50,
],
[
'name' : 'a',
'age' : 12,
'number' : 11,
'score' : 30,
],
[
'name' : 'b',
'age' : 12,
'number' : 12,
'score' : 50,
],
]
For example, for an array like this, check whether it is repeated based on name number age. If it is repeated, add the scores.
Thanks for the invitation!
Brother, I wrote you the simplest method to remove weights, take it and use it.