Page 1 of 1

read from file and separate strings

Posted: Wed Jan 11, 2006 5:54 pm
by duk
i have a file with a lot of lines... all of this lines are in this format...

name surname dd/mm/yy otherinfo otherinfo
name surname dd/mm/yy otherinfo otherinfo
name surname dd/mm/yy otherinfo otherinfo
name surname dd/mm/yy otherinfo otherinfo

what i want to do is read the file, and manipulate line by line inserting into array, when it finds the \n will look for the next line...
i have check explode function, but i just see obtions to explode when it finds something between strings and in this case i don't have nothing...

how can i do this ??

Posted: Wed Jan 11, 2006 5:57 pm
by John Cartwright
I'm not very good at regex so I don't know how to physically break up your string, but what I can tell you is if you open your file with file() then each line will be put into an array element already.

Posted: Thu Jan 12, 2006 7:30 am
by Weirdan

Posted: Thu Jan 12, 2006 8:02 am
by duk
that dont result for me...

what that will do is the first array[0] will have all until e find \n what i want is that explode check multiple combinations to result in:

array[0] = 1 string explode with" "
array[0] = 2 string explode with"/"
array[0] = 2 string explode with":"

i think i will need to check 1 by 1..