title: If statement is only checking that last iteration in while loop PHP
body: <p>I'm familiar with programming in general but what I'm facing is a bit weird. The if statement is only working on the last iteration:</p>
   
  <p>Output: IN IN OUT OUT OUT OUT IN OUT IN BIN BOUT OUT OUT OUT OUT</p>
  <p>However if I add an if statement it only performs on the last iteration:</p>
  <pre><code>&lt;?php
  
  $conn = mysqli_connect('localhost','root','','text');
  
  if(!$conn)
  {
      die(mysqli_error());
  }
  
  
  $open = fopen('test.txt','r');
  while (!feof($open)) 
  {
      
      $getTextLine = fgets($open);
      $explodeLine = explode(&quot;,&quot;,$getTextLine);
      list($Date,$ID,$Status) = $explodeLine;
      
      if($Status == &quot;OUT&quot;){
          echo &quot;$Status&quot;;
      }
  
  }
  fclose($open);
  ?&gt;
  </code></pre>
  <p>Output: OUT</p>
  <p>Text file:</p>
  <pre><code>19-04-21 13:41:38  ,0000000917         ,IN
  19-04-21 13:49:50  ,0000001310         ,IN
  19-04-21 13:52:24  ,0000000505         ,OUT
  19-04-21 13:53:36  ,0000000546         ,OUT
  19-04-21 14:05:24  ,0000001267         ,OUT
  19-04-21 14:05:32  ,0000001228         ,OUT
  19-04-21 14:06:26  ,0000000454         ,IN
  19-04-21 14:13:10  ,0000000990         ,OUT
  19-04-21 14:17:32  ,0000001354         ,IN
  19-04-21 14:27:04  ,0000000325         ,BIN
  19-04-21 14:27:18  ,0000000325         ,BOUT
  19-04-21 14:31:12  ,0000000649         ,OUT
  19-04-21 14:32:22  ,0000000061         ,OUT
  19-04-21 14:33:00  ,0000001301         ,OUT
  19-04-21 14:34:34  ,0000000548         ,OUT
  </code></pre>