Mutley Posted February 17, 2009 Share Posted February 17, 2009 How would I check if any of the numbers in an explode array match another? I'm familiar with explode and foreach/while statements but this would match a single value from the array, rather than checking if any of the numbers in the array match. Thanks, Nick. Quote Link to comment https://forums.phpfreaks.com/topic/145644-checking-results-in-an-explode/ Share on other sites More sharing options...
allworknoplay Posted February 17, 2009 Share Posted February 17, 2009 Try array_diff() function? Quote Link to comment https://forums.phpfreaks.com/topic/145644-checking-results-in-an-explode/#findComment-764599 Share on other sites More sharing options...
premiso Posted February 17, 2009 Share Posted February 17, 2009 in_array Running that on the array would tell you...granted if the array still contained that number it would return a "false positive" What is your plan to do with duplicate numbers? Remove them? If so you may want to look at array_unique also array_search or array_diff may be worth while to look at as well. Quote Link to comment https://forums.phpfreaks.com/topic/145644-checking-results-in-an-explode/#findComment-764600 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.