Anzeo Posted March 29, 2007 Share Posted March 29, 2007 Hi, I'm wandering if there's a function in php which lets you check for a variable value in a preset array, and how you could check this (TRUE / FALSE) For example: $variable = a; $array = array("a","b","c"); ??? Any help appreciated, TIA Link to comment https://forums.phpfreaks.com/topic/44806-solved-check-variable-value-in-array/ Share on other sites More sharing options...
per1os Posted March 29, 2007 Share Posted March 29, 2007 $var = "a"; $array = array("a", "b", "c"); if (in_array($var, $array)) print $var . " is in array!"; else print $var . " is not in array."; http://us2.php.net/in_array Link to comment https://forums.phpfreaks.com/topic/44806-solved-check-variable-value-in-array/#findComment-217572 Share on other sites More sharing options...
Anzeo Posted March 29, 2007 Author Share Posted March 29, 2007 Thanks , it's working! Link to comment https://forums.phpfreaks.com/topic/44806-solved-check-variable-value-in-array/#findComment-217587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.