Merge multi-dimensional arrays and sum column values which share a common value in another column
问题 I have 3 arrays for storing posts,comments, and likes. These are the JSON strings: //comments JSON (stores user and comment points) $comments='[ { "user": "5", "points": "12" }, { "user": "2", "points": "1" }, { "user": "3", "points": "1" } ]'; //likes(stores user and likes point) $likes='[ { "user": "1", "points": 7 }, { "user": "4", "points": 4 }, { "user": "3", "points": 1 } ]'; //posts (stores user and post points) $posts='[ { "user": "1", "points": "6" }, { "user": "3", "points": "2" },