title: PHP: search substring within a string using preg_match?
body: <p>Im trying to create a function to check for a substring within a string in php.</p>
  
  <pre><code>public static function stringCheck ($string, $substring) {
    $patern = "/".$substring."/";
  
    if (preg_match($substring, string) {
      return true;
    }
    else return false;
  }
  </code></pre>
  
  <p>but if i enter a special character used in preg_match (^.[$()|*+?{) it screws up the search.</p>
  
  <p>I tried something like the code below but that didnt work</p>
  
  <pre><code>$speicalChar = '/(\^|\.|\[|\$|\(|\)|\*|\+|\?|\{|\\)/';
  </code></pre>
  
  <p>Anyone have a solution or maybe an alternative to preg_match. keep in mind that i want to be able to check for symbols too. I tried using strstr but had issues with symbols.</p>
  
  <p>Thanks =]</p>