title: Finding a part of string in an array of strings
body: <p>Iv been looking for a way to search through an array of strings and find if there are any strings that contain a part of another string, if there is then i merge the whole array onto another array. EG:</p>
  
  <pre><code>Searching for jav:
  array-&gt;[java] -&gt; would return this value
  and add that whole array to another
  </code></pre>
  
  <p>After looking around on stackoverflow and testing i found this solution using strpos which works...kind of:</p>
  
  <pre><code>$matches=array(); //just here to show the array is declared and is filled with items prior to calling 
  
  foreach($myarray as $fn){
      if(strpos($fn,$searchString)){
          $matches = array_merge($myarray,$matches);
      }
      }
  </code></pre>
  
  <p>The issue is, instead of adding the whole array its adding my search string each loop however, after double checking a number of times i dont understand why. Tts adding the original search item rather than the entire other array....
  EG.</p>
  
  <p>If i search for jav as shown above the array will merge to create an array of the correct length but with the value :</p>
  
  <pre><code>javjavjavjavjav
  </code></pre>
  
  <p>Any help in understanding exactly why this is or how to correct it would be appreciated.</p>