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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Anzeo Posted March 29, 2007 Author Share Posted March 29, 2007 Thanks , it's working! Quote Link to comment 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.