- Jan 18, 2002
- 5,893
- 0
- 76
I'm trying to get something to work on my site and I'm having a little trouble getting some syntax right. I imagine I'm missing something pretty simple...
I've got text files with data in them. They go something like this:
xxxxxxxx|xxxxxxxx|xxxxxxxx
yyyyyyyy|yyyyyyyy|yyyyyyyy
I'm reading the data from the text files line-by-line into strings with no problems. So I end up with two strings from the above sample file, "xxxxxxxx|xxxxxxxx|xxxxxxxx" and "yyyyyyyy|yyyyyyyy|yyyyyyyy." Here's the problem. I'm trying to split them up into the three sections defined by the | character. For each of those strings, I'd get three smaller strings. I remember from doing a little perl a few years ago that there was a function that could split those up very easily into separate strings. The "split" function in php sort of looks like what I want but I've been having trouble getting it to do exactly what I want. Basically, is there a function in php that does what that perl function does? That'd make everything so much easier.
Thanks for any help anyone can provide. I hope this is a simple fix and I'm just missing something.
I've got text files with data in them. They go something like this:
xxxxxxxx|xxxxxxxx|xxxxxxxx
yyyyyyyy|yyyyyyyy|yyyyyyyy
I'm reading the data from the text files line-by-line into strings with no problems. So I end up with two strings from the above sample file, "xxxxxxxx|xxxxxxxx|xxxxxxxx" and "yyyyyyyy|yyyyyyyy|yyyyyyyy." Here's the problem. I'm trying to split them up into the three sections defined by the | character. For each of those strings, I'd get three smaller strings. I remember from doing a little perl a few years ago that there was a function that could split those up very easily into separate strings. The "split" function in php sort of looks like what I want but I've been having trouble getting it to do exactly what I want. Basically, is there a function in php that does what that perl function does? That'd make everything so much easier.
Thanks for any help anyone can provide. I hope this is a simple fix and I'm just missing something.
