Battery Powered
02-03-2003, 07:25 AM
Hi
Well this is what im using to open a test file:
$fp = @fopen("data.dat", "rb") or die("Couldn't open file");
while(!feof($fp))
{
$data .= fgets($fp, 1024);
}
fclose($fp);
$values = explode("\r\n", $data);
Which in other words is taking each line of the data.dat file and assigning:
$values[0] with the first line
$values[1] with the seccond line
$values[2] with the third line
and so on for each line in the file,
this is all working peechy but say i want to output the seccond line, i would use
print (" $values[1] ");
which works fine but i want to only output the first 25 words on that line,
is there a way to do this
Hope someone can help,
and hope i've made some sense : )
James
Well this is what im using to open a test file:
$fp = @fopen("data.dat", "rb") or die("Couldn't open file");
while(!feof($fp))
{
$data .= fgets($fp, 1024);
}
fclose($fp);
$values = explode("\r\n", $data);
Which in other words is taking each line of the data.dat file and assigning:
$values[0] with the first line
$values[1] with the seccond line
$values[2] with the third line
and so on for each line in the file,
this is all working peechy but say i want to output the seccond line, i would use
print (" $values[1] ");
which works fine but i want to only output the first 25 words on that line,
is there a way to do this
Hope someone can help,
and hope i've made some sense : )
James