Page 1 of 1
text file into array? (NOOB ASKING)
Posted: Fri Aug 18, 2006 2:17 am
by afbase
the syntax of my text file i would like to make into an array is 'company name' ten spaces 'ticker symbol' ten spaces 'stock exchange traded on' ten spaces, ie:
Code: Select all
1838 Bond Debenture Trading Fd BDF NYE
I was wondering how i can convert this to an array...
Look if this is too easy of a question, forward me to someone that will help or atleast give pointers... thanks?????
Posted: Fri Aug 18, 2006 2:18 am
by RobertGonzalez
Posted: Fri Aug 18, 2006 2:19 am
by feyd
your file sounds like it's regularly formatted, which means you don't need regex when
file(), a loop and
substr() will do just fine.
I finally have my array!!!
Posted: Fri Aug 18, 2006 12:47 pm
by afbase
ok, thanks to feyd and everah, I got some ideas how to build my array. This is just a tidbit of my array
Code: Select all
Array ( [0] => 1838 Bond Debenture Trading Fd [1] => BDF [2] => NYE [3] => 1st Tr 4 Corners Snr Fl Rt [4] => FCT [5] => NYE [6] => 1st Trust Aberdeen
This array is very long and i was wondering how I could group this array into three's. Eventually i'm going to use this array to insert into a mysql database.
I figured count() might help but not exactly sure about it.
Posted: Fri Aug 18, 2006 12:52 pm
by feyd
During each iteration of a line create a temporary array with that line's values. Store that resulting array into your collection array.
sweeT!!!!
Posted: Fri Aug 18, 2006 2:53 pm
by afbase
I just got it working to where i can start inserting data into mysql!!!!! thanks