For example, I have $dates1 and $dates2 shown below, and want to create $dates3, which keeps all dates in $dates1, and adds any unique dates in $dates2, ignoring any duplicates. The arrays contain other values but I’m just showing the dates because that’s what I want to merge/sort on.
$dates1=
Array
(
[0] => Array
(
[day] => 2012-01-01
[foo] => "bar"
)
[1] => Array
(
[day] => 2012-01-02
[foo] => "bar"
)
[2] => Array
(
[day] => 2012-01-03
[foo] => "bar"
)
)
$dates2=
Array
(
[0] => Array
(
[day] => 2011-12-31
)
[1] => Array
(
[day] => 2012-01-01
)
[2] => Array
(
[day] => 2012-01-02
)
[3] => Array
(
[day] => 2012-01-03
)
[4] => Array
(
[day] => 2012-01-04
)
)
So I would like to merge $dates2 into $dates1, ignoring any duplicates, to make $dates3:
Array
(
[0] => Array
(
[day] => 2011-12-31
)
[1] => Array
(
[day] => 2012-01-01
[foo] => "bar"
)
[2] => Array
(
[day] => 2012-01-02
[foo] => "bar"
)
[3] => Array
(
[day] => 2012-01-03
[foo] => "bar"
)
[4] => Array
(
[day] => 2012-01-04
)
)
I’m not sure I understand you correctly, do you mean something like this?