• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick PHP question

Supermercado

Diamond Member
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.

 
Thanks, Modeps. It looks like explode() is similar to what I had in mind. I'll give that a shot in a bit and see if I can get it to work. Thanks.
 
Back
Top