Question: I'm pretty capable when coding PHP though I just came across a situation where I wondered if it would be possible to use `stristr` to match any value in an array inside a *SINGLE* if condition. I don't need/want a class, a dedicated function or anything super-complex nor am I doing anything complex such as trying to match special characters, I just think I may have missed something useful over at php.net.

The general notion...

```
if (stristr($search_this,$array_with_values)) {echo 'a match was found';}

```

...or what would amount to (even though this does not work)...

```
if (stristr($search_this,array('string1','string2'))) {echo 'a match was found';}

```

...I might try to find the strings 'apple','orange','banana' in a regular sentence/string.

I can define the array outside of the if condition.

My main goal is to simply not have numerous if conditions or use multiple operators such as && or ||.

So I do not want to have multiple || operators like this if possible...

```
if (
stristr($search_this_string,'string1') || 
stristr($search_this_string,'string2') || 
stristr($search_this_string,'string3')
) {echo 'a match was found';}

```

I don't mind having the array before/outside of the if condition though I want to be able to fit everything else inside of a single if condition.

Answer: 
I doubt this is performant, but if you are looking for a reasonably simple-looking one-liner:

```
if( str_ireplace(array('string1', 'string2'), '', $str) != $str )
{
  echo 'a match was found';
}

```
You can use a workaround construct:

```
 if (array_filter(array_map("stristr", array_fill(0, count($array), $sentence), $array))) {

```

That will apply [`stristr`](http://php.net/stristr) to each element. [`array_filter`](http://php.net/array_filter) will keep only the set elements, so the boolean condition can either match (array with elements) or fail (empty array).

**Edit**: Ok, not that easy. You need an auxillary list (`array_fill` with source text) as using `stristr` requires two params from [`array_map`](http://php.net/array_map).

Note that you give up short circuit evaluation with that. And despite common myths, it would be speedier to just use `preg_match` for such cases (might even be less code).