Okay so you're making a form that where the user inputs search terms and those search terms are applied to the entries in a database right?
So the initial Array (we'll call it $results_array) would be filled with all the entries in the database. Since you can't hand code a hundred search queries you need to seperate out the searching from the normal flow. You have the users search terms in an array called $query_array.
You want to loop over query_array with a function that compares each value of results_array to a term from query_array and returns an array containing the matches.
PHP Code:
function reduce( $results_array, $search_term ){
$new_results = array();
foreach( $results_array as $item ) {
if (preg_match ("/$search_term/i", $item)) {
$new_term[] = $item;
}
}
return $new_results;
}
Now since that array will get smaller each time you run reduce with different terms, at the end of query_array, results_array will only contain entries that match all of the search terms.