I have two multi dimensional arrays. I want to compare them and add unique items to a new array. I would like to compare each field of the array (year, month, day, time)
Current Array =
array(0) {
[0]=>
array(5) {
["year"]=>
string(4) "2015"
["month"]=>
string(1) "3"
["day"]=>
string(1) "5"
["time"]=>
string(4) "0900"
}
[1]=>
array(5) {
["year"]=>
string(4) "2015"
["month"]=>
string(1) "3"
["day"]=>
string(1) "6"
["time"]=>
string(4) "0800"
}
}
Insert Array =
array(1) {
[0]=>
array(5) {
["year"]=>
string(4) "2015"
["month"]=>
string(1) "3"
["day"]=>
string(1) "6"
["time"]=>
string(4) "0800"
}
[1]=>
array(5) {
["year"]=>
string(4) "2015"
["month"]=>
string(1) "3"
["day"]=>
string(1) "7"
["time"]=>
string(4) "0800"
}
}
In this case the first item from the insert array would be saved to the new array. I would like to do this with 100+ items potentially. The end goal is to not allow duplicate inserts on the table. Thanks for the input.
Found it: Compare two multidimensional arrays then create array of only unique