Fastest way to explode / split in PHP?
So I have a string which looks like this;
[CONTACT]John[FNAME]Doe[LNAME]0754XXXXXXX[ENDNO][ENDCONTACT]
What is the best way to iterate through the string and assign variables to
each part? At the moment I am doing an explode with
[ENDCONTACT]
as the delimeter.
And then doing a foreach to loop through the rest of the string. This is
where I'm stuck, whats the best way to split the rest of the string up
based on the tags.
The end result would be something like;
$fname = "John"; $lname = "Doe";
etc
Thanks!
No comments:
Post a Comment