KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to get two arrays to merge into one while keeping all the keys in place and listing the values in an array like in this example: $array1 = [ 'car' => '3', 'bus' => '2' ]; $array2 = [ 'dog' => '1', 'car' => '2', 'bird' => '9' ]; Desired result: $merged = [ 'car' => ['3', '2'], 'bus' => ['2', null], 'dog' => [null, '1'], 'bird' => [null, '9'] ];
Tags (comma-separated)
Save Edits
Cancel