title: PHP issue reading huge data from txt files
body: <p>I'm running a php script that reads from some pipe-delimited txt files, those files contain around 22,000 records. I'm using PHP file() function to read those files, BTW the files have some inter-relation too, I'm pasting the code here for better understanding</p>
  
  <pre><code>public function getGames()
  {
      $resource = self::DATAFILES.'Product.txt';
  
      $games = array_slice($this-&gt;readFile($resource), 1); 
      $data = array();
      $count = 1;
      foreach($games as &amp;$records)
      {
          $game = new Game();
          $attributes = explode($this-&gt;delimiter,$records);
          $game-&gt;api   =  (int) $attributes[0];
          $game-&gt;console_id = (string) $attributes[1];
          $game-&gt;title = (string) $this-&gt;getTitle($attributes[2]);
          $game-&gt;barcode = (string) $attributes[4];
          $game-&gt;image = $this-&gt;getCoverImage($attributes[0]);
          $game-&gt;releateDate = strtotime($attributes[8]);
          $data[] = $game;
          //if($count == 100): break; else: $count++; endif;
      }
  
      print '&lt;pre&gt;'; print_r($data); 
  
  
  }
  
  public function getTitle($titleID)
  {
      $resource = self::DATAFILES.'Title.txt';
  
      $titles = array_slice($this-&gt;readFile($resource), 1); 
  
      foreach($titles as $records)
      {
          $attributes = explode($this-&gt;delimiter,$records);
  
          $pattern = '/^' . preg_quote($attributes[0], '/') . '$/';
          if (preg_match($pattern, $titleID))
          {
              return $attributes[2];
              break;
          }
  
      }
  
  }
  
  public function getCoverImage($gameID)
  {
      $resource1 = self::DATAFILES.'ProductImage.txt';
  
      $coverImages = array_slice($this-&gt;readFile($resource1), 1); 
  
      foreach($coverImages as $img_records)
      {
          $image_attributes = explode($this-&gt;delimiter,$img_records);
  
          $pattern1 = '/^' . preg_quote($image_attributes[0], '/') . '$/';
          $pattern2 = '/^' . preg_quote($image_attributes[3], '/') . '$/';
  
          if (preg_match($pattern1, $gameID) &amp;&amp; preg_match($pattern2, 'Cover'))
          {
              return $image_attributes[2];
              break;
          }
  
      }
  </code></pre>
  
  <p>So the problem I'm facing here is that - when I run that script it will just go on and on nothing happens i.e never throws any error neither print the returned array, however when I limit's the loop iteration up to 100 it works which means nothing wrong with the code so I thought perhaps, php script execution time making trouble so I changed it to max_execution_time = 0 - but still not getting the results. Any help or suggestion, would love hear that.. :) </p>
  
  <p>BTW I'm using Xampp Apache for my local dev !</p>