severndigital Posted August 14, 2007 Share Posted August 14, 2007 ok I have an array $salt = array('A','C','D','F','P','N'); and I have a value $var = 'Z'; The example is in Letters because the vars I will be matching are letters. I want to check it against the array and see if it matches any of the values. I could write a long ifelse() statment but i was hoping to do in 2 or 3 lines instead. In knowing that that array may change in the future. any ideas?? thanks, chris Link to comment https://forums.phpfreaks.com/topic/64918-solved-check-value-against-an-array/ Share on other sites More sharing options...
Orio Posted August 14, 2007 Share Posted August 14, 2007 Use in_array() Orio Link to comment https://forums.phpfreaks.com/topic/64918-solved-check-value-against-an-array/#findComment-323922 Share on other sites More sharing options...
severndigital Posted August 14, 2007 Author Share Posted August 14, 2007 thanks, I searched php.net for 30mins and came up empty.. thanks again, chris Link to comment https://forums.phpfreaks.com/topic/64918-solved-check-value-against-an-array/#findComment-323928 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.