See if this can help you:
<?PHP
// Path and filename to the file you want to read
$filename = "thefile.txt";
// Open, reads and closes the file
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
// Spilts the $content in every new line
$lines = preg_split("/\n/", $contents, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
// Loops over $lines
for ($i=0; $i < count($lines); $i++) {
// Gets the 2 first letter in the line
$header[$i] = substr($lines[$i], 0, 2);
// Gets the rest of the line (after 2 letters)
$data[$i] = substr($lines[$i], 2);
// Output - Remove this when you don't need it...
echo "<b>$header[$i]:</b> $data[$i]<br>";
}
?>
This will output this:
IH: DI171800
IR: TEST FOODS
IS: TEST & COMPANY 0353757570001 5520 W. HAROLD GATTY RD
IB: NICHOLAS & COMPANY 035375570001 P.O. BOX 45005
II: 002100066627 SUBWAY 8/64Z REG MAYO 13.57
II: 002100067747 SUBWAY 8/64Z LT MAYO 10.23
II: 002100072433 SUBWAY 200/7/16Z LT MAYO POU 7.2
lT: 3 7640.49 7747.20 7485.