<?php
$file = 'GPSserial.txt' or die('could not open file!');
$handle = @fopen($file, "r") or die("could not open file!");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
$GPSstr = $buffer;
$GPSarray = explode(',', $GPSstr);
if ( $GPSarray[0] == '$GPGGA'){
echo 'congrats';
}
else{
// move to the next line
}
}
?>
above is a code that opens a text file and scans it until eof is reached. basically the text file contains "sentences" that have begin with "headers" such as $GPGGA. Each sentence is written in a newline. can anyone help me such that once the header of the sentence is recognized as not being $GPGGA, the program would then move to the next line and check that "sentence's" header? thank you very much