I have searched alot, but can't find the exact similair question. The built-in function in PHP don't do what I'm looking for. Note: array_merge_recursively(...) came close, but didn't keep the indexes.
I have for example to arrays in PHP (json visualization):
[
["1-6-13", 10],
["30-6-13", 13],
["20-9-13", 28]
]
and:
[
["18-2-13", 7],
["30-6-13", 9]
]
And I want to merge those two, based on their date. However not every date matches the other one, it is important that the value of array 1 will be on index 1, and the value of array 2 must be appended to index 2. The values which don't exists must be for instance null.
So the desired result would look like:
[
["18-2-13", null, 7],
["1-6-13", 10, null],
["30-6-13", 13, 9],
["20-9-13", 28, null]
]
I hope someone can help me out!