Friday, 15 March 2013

PHP - Use everything from 1st array, remove duplicates from 2nd? -


I have 2 arrays - first there is a complete output. In the second one, there may be some values ​​that are already with the array. Were already used. I want to "clear" the second array so that I can get my data out without worrying about showing duplicates. Just to make sure that I have the correct vocabulary & amp; There is no "array" within an array, so I use every one:

1 array

  $ firstResponse = $ Sth- & gt; Fatch ALL (); Forex Currency ($ First $ First Response as First Response) {Resonance $ First RatiosPage ['same column name']; // do not care that it is in 2 arrays}   

2 arrays

  while ($ secondResponseRow = $ dbRequest- & Gt; fetch_assoc ()) {$ secondResponseArray = array ($ secondResponseRow); Foreign exchange ($ secsports dollar as second seconds report) {echo $ secondResponseItem ['samecolumnname']; // it can not match anything above}}   

Thanks!

For example:

  $ response_names = array (); $ FirstResponse = $ sth- & gt; Fatch ALL (); Forex Currency ($ First $ First Response $ First Response) $ response_names [] = $ First ResponseImage ['same column name']; While ($ secondResponseRow = $ dbRequest-> fetch_assoc ()) {$ secondResponseArray = array ($ secondResponseRow); Foreign currency ($ secondResponseArray $ secondResponseItem) {if (! In_array ($ secondResponseItem ['samecolumnname'], $ response_names) $ response_names [] = $ secondResponseItem ['samecolumnname']; }} Array_Walk ($ response_names, function ($ value) {echo $ value. '& Lt; br / & gt;'});    

No comments:

Post a Comment