title: PHP's preg_match() acts weirdly
body: <p>I found this, when I'm working in regex validation in PHP.</p>
  <p>I've used <code>preg_match</code> function to validate a string.</p>
  <p>I've just printed that value returned by <code>preg_match</code> to ensure working flow.</p>
  <p>During that I've found a thing. But can't understand their concept.</p>
  <p>That was <code>preg_match()</code> returns 1 if the match found. Otherwise, it will return 0. But sometimes my print function didn't print anything.</p>
  <p>After I went through the PHP manual to know all of its return value...</p>
  <p>There they posted as follows...</p>
  <blockquote>
  <p>preg_match() returns 1 if the pattern matches given subject, 0 if it does not, or FALSE if an error occurred.</p>
  </blockquote>
  <p>And then I used <code>var_dump</code> to know anything is printed or not...</p>
  <p>This helped me to know that's a Boolean false.</p>
  <p>But I'm curious to know why it returns boolean false, when I'm just putting &quot; ! &quot; (not) before the <code>preg_match()</code>?</p>
  <p>Following is my code,</p>
  <pre><code>echo preg_match(&quot;/script/&quot;, &quot;script&quot;) // ===&gt; this returns 1
  
  echo !preg_match(&quot;/script/&quot;, &quot;script&quot;) // ===&gt; this returns Boolean false
  </code></pre>
  <p>I think it has to return integer 0 (zero)... What is its functionality? Or did I do anything wrong in syntax?</p>
  <p>I've tried this in the <a href="https://en.wikipedia.org/wiki/OpenCart" rel="nofollow noreferrer">OpenCart</a> 2.0.0.0 system administrator controller module.</p>