Here's what I think you wanted (from 2006) <?php
// The TRACreportshort takes Nexstorm's full TRACreport and shortens it to a more
// managable size for displaying.
//
// It chops up the vital storm cell info, places it in arrays, and redisplays it as we wish
//
// Set some default values
$measure = "mi"; // km, nm, or mi depending on your Nexstorm measurements
$tracwarnmeasure = 50; // number of measure to trigger a storm cell warning
// Load the TRACreport and remove carriage returns, change the word 'no change' to 'steady'
$trac = implode('', file('TRACReport.txt'));
$tracnopara = preg_replace( '|\n|', '=', $trac );
$tracnopara = preg_replace( '|No change|', 'Steady', $tracnopara );
// Intialize values
$tracreport = "";
$tnumber = 0;
$alertflag = 0;
$tracwarning = "";
// If there aren't any thunderstorms, then say it
if (preg_match("/No thunderstorms detected/i", $trac)) {
$tracreport = "No thunderstorms detected"; }
else {
// If there are thunderstorms, process them, putting them into various arrays
// $tnumber[x] is for number of thunderstorms
preg_match("/Tracking (.*) thunderstorms/Uis", $tracnopara, $tnumber);
// $tid[x] is the ID number of the storm
preg_match_all("/Thunderstorm ID (.*) detected/Uis", $tracnopara, $temp);
$tid = $temp[1];
// $tdtime[x] is the time detected
preg_match_all("/detected (.*)=/Uis", $tracnopara, $temp);
$tdtime = $temp[1];
// $tdirection[x] is the direction of the storm
preg_match_all("/Storm location bearing (.*) dgr/Uis", $tracnopara, $temp);
$tdirection = $temp[1];
// $tdistance[x] is the distance in $measure amounts
preg_match_all("/distance (.*) $measure/Uis", $tracnopara, $temp);
$tdistance = $temp[1];
//$tintensity[x] is the intensity of the storm
preg_match_all("/Intensity class (.*)=/Uis", $tracnopara, $temp);
$tintensity = $temp[1];
//$ttrend[x] is the trend of the storm
preg_match_all("/Intensity trend (.*)=/Uis", $tracnopara, $temp);
$ttrend = $temp[1];
// Set working for the header based on number of thunderstorms
if ($tnumber[1] == 1) {
$tracreport = "Tracking " . $tnumber[1] . " storm cell<br/>";
} elseif ($tnumber[1] > 1) {
$tracreport = "Tracking " . $tnumber[1] . " storm cells<br/>";
} else {
// Sometimes the TRACreport is empty so we need to say that
$tracreport = "No data currently available<br/>";
}
// Process the arrays
for($k=0;$k<$tnumber[1];$k++) {
// Sets the alert flag to 1 meaning that there is a storm within a given distance
// This can be used to display an alert to visitors
if ($tdistance[$k] <= $tracwarnmeasure) { $alertflag = 1;}
// This builds each line of text for each thunderstorm
$tracreport = $tracreport . "Cell ID " . $tid[$k] . " detected at " . $tdtime[$k] . " from " . $tdirection[$k] . "° at a distance of " . $tdistance[$k] . " miles. Storm is " . strtolower($tintensity[$k]) . " and " . trim(strtolower($ttrend[$k])) . ".<br/>";
}
$tracreport = $tracreport . '<br/>';
}
if ($alertflag == 1) {
// You can change the HTML in this warning to anything you want.
// I display it on my main webpage with a link to the lightning page
$tracwarning = '<br />LIGHTNING ALERT</b> ... We have detected a nearby storm cell ... <br />';
}
echo $tracreport;
echo $tracwarning;
?>