title: PHP preg_match returns false
body: <p>In the following code why the PHP preg_match returns false?
  note: I have read some older questions with the same title as my question but the context was different</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;?php
          $str = "This is a test for PCRE.";
          $ptrn = "This";
          $preg_match_result_arr;
          $preg_match_result = preg_match($ptrn, $str, $preg_match_result_arr);
  
          if (1 === $preg_match_result)
          {
              echo "The pattern has matched in the string:&lt;br/&gt;".
                  "the match is $preg_match_result_arr[0]&lt;br/&gt;";
          }   
          elseif (0 === $preg_match_result) 
          {
              echo "The pattern has not matched in the string:&lt;br/&gt;";
          }
          elseif (false === $preg_match_result)
          {
              echo "An error has occured in matching&lt;br/&gt;";
          }
  
          ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>