I have an reference array like this (the data amount is dynamic, about 3000 records)
Array
(
[0] => Array
(
[DEPT] => FIN
[KEYCODE] => AAAAA
[TYPE] => 7
)
[1] => Array
(
[DEPT] => SALE
[KEYCODE] => BBBBB
[TYPE] => 16
)
[2] => Array
(
[DEPT] => SCM
[KEYCODE] => CCCCC
[TYPE] => 1
)
)
and use the value of "TYPE" to search keys "[9][7][16][1]" and value of "KEYCODE" to search value of above keys in following array. (dynamic, about 5000 records)
Array
(
[0] => Array
(
[NAME] => Nick
[9] => GGGGG
[7] => AAAAA
[16] => MMMMM
[1] => KKKKK
)
[1] => Array
(
[NAME] => Chris
[9] => PPPPP
[7] => BBBBB
[16] => ZZZZZ
[1] => RRRRR
)
[2] => Array
(
[NAME] => Cathy
[9] => SSSSS
[7] => UUUUU
[16] => JJJJJ
[1] => AAAAA
)
[3] => Array
(
[NAME] => Allen
[9] => FFFFF
[7] => DDDDD
[16] => WWWWW
[1] => CCCCC
)
)
the output array should be
Array
(
[0] => Array
(
[NAME] => Chris
[9] => PPPPP
[7] => HHHHH
[16] => ZZZZZ
[1] => RRRRR
)
[1] => Array
(
[NAME] => Cathy
[9] => SSSSS
[7] => UUUUU
[16] => JJJJJ
[1] => XXXXX
)
)
"Nick" have item [7]=> AAAAA and "Allen" have item [1]=> CCCCC, so delete from data array. I know the way to delete array item, but no idea to implement compare and search by key/value pair from other array.
KEYCODEfrom the first array based onTYPEand then delete a whole record in the second one based on the foundKEYCODE? Can there be multiple values ofKEYCODEfor the sameTYPE?