loudog Posted August 7, 2011 Share Posted August 7, 2011 hey guy's. Im trying to write my own function for array_udiff_assoc. So i need to compare two arrays in the same function and i was thinking that the best way would be to go element by element in other words compare each individual key to each other. for example compare key1 or array to key one of array2. My question is how can i compare each key of the array to each other?? Does it make sense?? $a1=array(1=>"Dog",2=>"Cat",3=>"Horse"); $a2=array(1=>"Cat",2=>"Horse",3=>"Dog"); Quote Link to comment https://forums.phpfreaks.com/topic/244165-question/ Share on other sites More sharing options...
MasterACE14 Posted August 8, 2011 Share Posted August 8, 2011 why not just use array_diff_assoc() ? Quote Link to comment https://forums.phpfreaks.com/topic/244165-question/#findComment-1253925 Share on other sites More sharing options...
loudog Posted August 8, 2011 Author Share Posted August 8, 2011 that's a good idea but wouldn't that be cheating?? Im a newbie and i have a list of per set functions that i want to rewrite. Im doing this cuz it will help me better understand and know that tool's i have to my disposal. Is there any other way?? Quote Link to comment https://forums.phpfreaks.com/topic/244165-question/#findComment-1253928 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.