KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following two arrays of objects: First Array: $array1 Array ( [0] => stdClass Object ( [id] => 100 [name] => Muhammad ) [1] => stdClass Object ( [id] => 102 [name] => Ibrahim ) [2] => stdClass Object ( [id] => 101 [name] => Sumayyah ) ) Second Array: $array2 Array ( [0] => stdClass Object ( [id] => 100 [name] => Muhammad ) [1] => stdClass Object ( [id] => 103 [name] => Yusuf ) ) I want to merge these two object arrays (removing all duplicates) and sorted according to id . Desired output: Array ( [0] => stdClass Object ( [id] => 100 [name] => Muhammad ) [1] => stdClass Object ( [id] => 101 [name] => Sumayyah ) [2] => stdClass Object ( [id] => 102 [name] => Ibrahim ) [3] => stdClass Object ( [id] => 103 [name] => Yusuf ) )
Tags (comma-separated)
Save Edits
Cancel