Skip to content
Advertisement

Split string into two

So I have a php page which GETs a form with a string looking like this:

FE:99792913V00.00.01.00038;SW:99792937V00.00.01.00022 I should like to make two string instead of one, looking like this:

JavaScript

The only way I can think of doing this is by splitting with explode() and then implode it back to a string, but is this the best way?

JavaScript

Advertisement

Answer

Yes, explode() and implode() are fast, reliable, and made for this sort of requirement.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement