php - Remove data from array according to the second one -


i have array contain - name, email, , id have second array contain same parameters, different data

i remove cells, first array, emails don't exist in second array. instance - first array:

array (size=4)   0 =>      array (size=3)       'name' => string 'shlomi green' (length=25)       'email' => string 'shlomig$mail.co.il' (length=25)       'contactid' => string '28' (length=2)   1 =>      array (size=3)       'name' => string 'roi keen' (length=21)       'email' => string 'roi@mail.com' (length=16)       'contactid' => string '53' (length=2)   2 =>      array (size=3)       'name' => string 'ronen' (length=8)       'email' => string 'ronen$mail.com' (length=23)       'contactid' => string '43' (length=2)   3 =>      array (size=3)       'name' => string 'shlomi' (length=10)       'email' => string 'shlomi$mail.co.il' (length=17)       'contactid' => string '54' (length=2) 

second array:

array (size=4)   0 =>      array (size=3)       'name' => string 'shlomi green' (length=25)       'email' => string 'shlomig$mail.co.il' (length=25)       'contactid' => string '28' (length=2)   1 =>      array (size=3)       'name' => string 'ronen' (length=8)       'email' => string 'ronen$mail.com' (length=23)       'contactid' => string '43' (length=2) 

only "shlomig$mail.co.il" , "ronen$mail.com" stay first array

you can user array_intersect if values string.

however, in case values relate different string representation, although wanted of them considered equal, should take @ array_uintersect. method, it's possible use custom comparison function callback.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -