Monkuar Posted September 6, 2012 Share Posted September 6, 2012 $correct = array("APNG","TIFF","RAW","BMP","SVG","WEBP","EXIF","PNM","PBM","PGM","PPM"); Now: if (in_array('PGM','TIFF',$correct)){ echo " You have 2 correct! "; } How would I go about making it search for arrays in arrays? The above does not WORK because it's searching for 2? How can i search for 2 or more? Link to comment https://forums.phpfreaks.com/topic/268075-how-to-find-values-in-a-array/ Share on other sites More sharing options...
requinix Posted September 6, 2012 Share Posted September 6, 2012 Call in_array() multiple times. Link to comment https://forums.phpfreaks.com/topic/268075-how-to-find-values-in-a-array/#findComment-1375774 Share on other sites More sharing options...
Jessica Posted September 6, 2012 Share Posted September 6, 2012 $correct = array("APNG","TIFF","RAW","BMP","SVG","WEBP","EXIF","PNM","PBM","PGM","PPM"); $check = array('PGM','TIFF'); $in_first = count(array_intersect($correct, $check)); echo "You have $count correct!"; Not tested. Link to comment https://forums.phpfreaks.com/topic/268075-how-to-find-values-in-a-array/#findComment-1375809 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.