split vs. preg_split vs. explode

I have an array which has pipe (|) delimited fields within that array. I want to loop through, split or explode out the fields and then print them out in a report.

What are the advantages/disadvantages/issues with each one of these and which is preferable in this situation?

    Since your data is split by only one character (a pipe), I'd recommend using explode because you don't need to use regular expressions.

    Using explode will be faster because you won't be using the regular expression engine.

      After posting the question, I read a bit further and found that explode would be faster and since I've got about 6500 records to go through, fast is what I need. Thanks.

        Write a Reply...