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; } 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 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. Link to comment https://forums.phpfreaks.com/topic/190995-compare-array/#findComment-1007175 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.