Re: [PHP] Creating an array with a file

2002-02-11 Thread DL Neil
Scott, > I am seeking some thoughts on if this is the way I should tackle this > problem. I have two files, both of them tab delimited text files that I > need to combine and then output a new file. > > My idea was to put both files in an array, calling the fields I need, > i.e. $field[0], $fiel

RE: [PHP] Creating an array with a file

2002-02-10 Thread Scott
[PHP] Creating an array with a file try this, you need to get the line then explode that, fopen just returns a file handle. $file = fopen("oldfile.txt", "r"); while (!feof ($fd)) { $lines = fgets($file, 4096) $newfields = explode("\t", $lines); echo $newfields[0].&q

Re: [PHP] Creating an array with a file

2002-02-10 Thread Bogdan Stancescu
You need to actually read the file in order for this to work. You're just opening it and then printing the file handle... Bogdan Scott wrote: > 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

RE: [PHP] Creating an array with a file--Fixed

2002-02-10 Thread Scott
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