title: PHP - If an array contains part of a string
body: <p>I have the following PHP code:-</p>
  
  <pre><code>&lt;?php
  if( have_rows('postcode_checker', 'option') ):
      while ( have_rows('postcode_checker', 'option') ) : the_row(); ?&gt;
          &lt;?php 
              $postcodes .= get_sub_field('postcodes');
              $postcode_url = get_sub_field('page');
          ?&gt;
      &lt;?php endwhile;
  else : endif;
  
  $postcode_array = $postcodes; // This collects postcodes, i.e. LE67, LE5 etc...
  $postcode_array = explode(',', $postcode_array);
  $postcode_array = str_replace(' ', '', $postcode_array);
  $postcode_search = $_POST['postcode']; // This will be a single postcode i.e. LE67
  
  if (in_array($postcode_search, $postcode_array)) {
  echo 'yes';
  } else {
  echo 'no';
  }
  ?&gt;
  </code></pre>
  
  <p>So the code above is working fine if I want to look up say LE67 and it finds LE67 in the array and returns <code>'yes'</code>. Now if I search LE675AN for example it will return <code>no</code> even though it needs to be returning yes as it is within the postcode area.</p>
  
  <p>Any idea's on how I can achieve this?</p>