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. 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? 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. 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
Archived
This topic is now archived and is closed to further replies.