Skipping a line (flatfile)
Posted: Sun May 16, 2004 10:21 am
Hey 
Say if my flatfile looks like this...
data1||111||111||111
data2||222||222||222
data3||333||333||333
...and I want to create a function/loop which explodes each lines into variables ( $data[0] = data2, $data[2] = 222, etc.), but I'm not interested in the first line, how would I do that?
Below is my (simplified) old code which works but also lists line one of the flatfile:
Say if my flatfile looks like this...
data1||111||111||111
data2||222||222||222
data3||333||333||333
...and I want to create a function/loop which explodes each lines into variables ( $data[0] = data2, $data[2] = 222, etc.), but I'm not interested in the first line, how would I do that?
Below is my (simplified) old code which works but also lists line one of the flatfile:
Code: Select all
$file = file(flatfile.txt);
foreach($file as $v)
{
$info=explode("||",$v);
print ' <tr>';
print ' <td>'.$infoї0].'</td>';
print ' <td>'.$infoї1].'</td>';
print ' <td>'.$infoї2].'</td>';
print ' <td>'.$infoї3].'</td>';
print ' </tr>';
}