Nevermind, I was able to figure it out using:

$myfile = file("oldfile.txt");
for ($s=0; $s<=count($myfile)-1; $s++) {
    $fields = split("\t",$myfile[$s]);
    print("$fields[1]\n");
}

-----Original Message-----
From: Scott [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 11, 2002 12:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Creating an array with a file

Hi All,

I am trying to create an array from a text file that I will process and
rewrite in a new format.  My question is, is it possible to read the
file 
in one line at a time and then separate the tab-delimited fields and
finally rewrite the new file?

The fields are tab delimited and here is what I have attempted in code:

$lines = fopen("oldfile.txt", "r");
$newfields = explode("\t", $lines);
echo $newquotes[0];

I get a Resource ID #1 when I echo the line.  

Thanks,

-Scott


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to