skip first line
Posted: Fri Feb 15, 2008 3:38 pm
Hi,
How Can I ignore the first line when I'm reading a file. I need it to work with my code below.
Below is the code that goes through the files.
Thanks!
How Can I ignore the first line when I'm reading a file. I need it to work with my code below.
Below is the code that goes through the files.
Code: Select all
//parse contents in file
$file_handle = file_get_contents('./logs/' . $filename);
// Explodes .txt file into lines (\n)
$Lines = explode("\n",$file_handle);
//display fields from file
foreach($Lines as $Line) {
$Line = preg_replace('/\s\s+/', ' ', trim($Line));
$fields = explode(" ",$Line);
echo $fields[1] . ' ' . $fields[2] . ' ' . $fields[3] . '<BR>';
}
}