title: Why preg_match() always validates as true when partial match?
body: <p>Recently been explerimenting with regular expressions and when I've tried to confirm that the <code>preg_match()</code> function was not returning the expected result (<code>false</code>). I've realised that my regex would evaluate to true with both a partial and full match.</p>
  
  <p>Can anyone more experienced share some comments on why this is working like this?</p>
  
  <p>I've tested this using the following code:</p>
  
  <pre><code>&lt;?php
  
  # Storing regexp.
  $pattern = "/Banana|Apples/i";
  
  # Storing value that will be compared against regexp.
  $value = "Chiiiiiiiibanana";
  
  # Testing how preg_match is dealing with the regexp.
  if (preg_match($pattern, $value, $matches)) {
      echo "It's a match!\n";
  
      # In case there's matches, print them.
      print_r($matches);
  } else {
      echo "Sorry, not a match.";
  }
  
  ?&gt;
  </code></pre>
  
  <p>In this case regex returns <code>1</code> (true) although "<code>bananas</code>" as "<code>Chiiiiiiii</code>" prefixing it. Any thoughts?</p>