Cardale Posted February 5, 2010 Share Posted February 5, 2010 I need to compare an array, but I am not sure how. I wanted to compare an array in an if statement with a GET variable. $array = array('test1', 'test2' ); if($_GET['check']!=$array){ $this = $default; } Quote Link to comment https://forums.phpfreaks.com/topic/190995-compare-array/ Share on other sites More sharing options...
MadTechie Posted February 5, 2010 Share Posted February 5, 2010 What exactly are you trying to do ? you could use inarray,array_search, even a loop or even serialize both arrays.. but without more detail its hard to make a useful suggection Quote Link to comment https://forums.phpfreaks.com/topic/190995-compare-array/#findComment-1007151 Share on other sites More sharing options...
Cardale Posted February 5, 2010 Author Share Posted February 5, 2010 in_array worked great thank you. Quote Link to comment https://forums.phpfreaks.com/topic/190995-compare-array/#findComment-1007175 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.