title: How to find a string in an array in PHP?
body: <p>I have an array:</p>
  
  <pre><code>$array = array("apple", "banana", "cap", "dog", etc..) up to 80 values.
  </code></pre>
  
  <p>and a string variable:</p>
  
  <pre><code>$str = "abc";
  </code></pre>
  
  <p>If I want to check whether this string (<code>$str</code>) exists in the array or not, I use the <code>preg_match</code> function, which is like this:</p>
  
  <pre><code>$isExists = preg_match("/$str/", $array);
  
  if ($isExists) {
      echo "It exists";
  } else {
      echo "It does not exist";
  }
  </code></pre>
  
  <p>Is it the correct way? If the array grows bigger, will it be very slow? Is there any other method? I am trying to scaling down my database traffic.</p>
  
  <p>And if I have two or more strings to compare, how can I do that?</p>