Seeing if a value matches anything in an array
| From: | Leif K-Brooks | Date: | Mon, 15 Apr 2002 21:54:21 +0000 |
| Subject: | Seeing if a value matches anything in an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-93098@lists.php.net to get a copy of this message | ||
I'm trying to build some sort of AI chat bot in php (yes, I know I'm crazy).
To do this, I need some way to check for the presence of any value from an
array. Example:
$pharray = array("php","the best language ever");
if($question == "What is ".anything_in_array_function($phparray)."?"){
print "Php is a programming language used mostly as a web scripting
language. (put some more stuff about php here)";
}
What is the best way to do something like this?