PHP - Checking whether a string exists in an entire array?

Posted by RC on Stack Overflow See other posts from Stack Overflow or by RC
Published on 2010-04-06T23:56:24Z Indexed on 2010/04/07 0:03 UTC
Read the original article Hit count: 145

Filed under:
|
|

Hi all,

Basic array question:

$string = "The quick brown cat";

$check1 = "apple";
$check2 = "ball";
$check3 = "cat";

if ( (stripos($string, $check1) === false) ||
     (stripos($string, $check2) === false) ||
     (stripos($string, $check3) === false)
   ) {
   echo "Fail";
}

How do I condense the above using an array ($check[])?

Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about array