title: Need assistance matching an exact string in PHP array
body: <p>I have a text file that has item numbers in it (one per line). When an item is scanned by our barcode scanner it gets placed into this text file IF it exists in the order (which is stored in an array...item numbers only, nothing else).</p>
  
  <p>What's happening is that if I have the two item numbers:</p>
  
  <p>C0DB-9700-W
  C0DB-9700-WP</p>
  
  <p>If I scan the item C0DB-9700-W first then I can scan the second item just fine, but if I scan C0DB-9700-WP first, it thinks that I've already scanned C0DB-9700-W because that item is a prefix to the item I've already scanned.</p>
  
  <p>I know that strpos only checks for the first occurrence. I was using the following code:</p>
  
  <p><code>if (strpos($file_array, $submitted ) !==FALSE) {</code></p>
  
  <p>I switched to using:</p>
  
  <p><code>if (preg_match('/'.$submitted.'/', $file_array)) {</code></p>
  
  <p>I thought that by using preg_match I could overcome the problem, but apparently not. I just want PHP to check the EXACT string I give it against items in the array (which I'm getting from the file) to see if it has already been scanned or not. This isn't that hard in my mind but obviously I'm missing something here. How can I coax PHP into looking for the entire string and not giving up when it finds something that will be good enough (or at least what it thinks is good enough)?</p>
  
  <p>Thanks!</p>