the_oliver Posted February 22, 2010 Share Posted February 22, 2010 Hi, I have two arrays and want to remove anything that appears in the firest array, from the second array. This is the code i have: foreach ($file_array as $key => $value){ foreach ($files_to_keep_array as $ftk_key => $ftk_value){ if ($value == $ftk_value){ unset($file_array[$key]); } } } Both arrays have the correct data in, and no errors are given, but the items are not removed from the first array ($file_array). Where am i going wrong? Many Thanks. - Oliver Quote Link to comment https://forums.phpfreaks.com/topic/192996-removing-items-in-one-array-from-another/ Share on other sites More sharing options...
the_oliver Posted February 22, 2010 Author Share Posted February 22, 2010 Sorry, My pore code else where. The above worked fine! Quote Link to comment https://forums.phpfreaks.com/topic/192996-removing-items-in-one-array-from-another/#findComment-1016442 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.