I have two arrays.
$array1 :
Array (
[0] => Array (
[time] => 100
[text] => Hello
)
[1] => Array (
[time] => 200
[text] => World!
)
[3] => Array (
[time] => 300
[text] => Array1's There
)
)
and more...
$array2 :
Array (
[0] => Array (
[time] => 50
[text] => Hello
)
[1] => Array (
[time] => 150
[text] => World!
)
[3] => Array (
[time] => 300
[text] => Array2's There
)
)
and more ...
$desiredResult :
Array (
[0] => Array (
[time] => 50
[text] => Hello
)
[1] => Array (
[time] => 100
[text] => Hello
)
[2] => Array (
[time] => 150
[text] => World
)
[3] => Array (
[time] => 200
[text] => World
)
[4] => Array (
[time] => 300
[text] => Array1's There
)
[5] => Array (
[time] => 300
[text] => Array2's There
)
)
I need to merge two array by time's numeric value, and if time's value the same, Array1's data first.