Problem using split function with string that includes "&"
Posted: Wed Feb 20, 2008 3:18 pm
Hi,
First of all, hello everyone. I'm new on this forum, a relatively junior PHP programmer and I have an issue. I did much Googling with no result.
I have a string of this format: aaaaa&aaaa:bbbbb&bbbbbb
I want to split this string into two, separated by the : character.
I used split(":",$string); but I do not get 2 strings, I get 4. The & character seems to mess up the split function.
I get the same thing with preg_split(), and explode()
What should I be doing to handle strings that include the & character?
Regards,
Mike
First of all, hello everyone. I'm new on this forum, a relatively junior PHP programmer and I have an issue. I did much Googling with no result.
I have a string of this format: aaaaa&aaaa:bbbbb&bbbbbb
I want to split this string into two, separated by the : character.
I used split(":",$string); but I do not get 2 strings, I get 4. The & character seems to mess up the split function.
I get the same thing with preg_split(), and explode()
What should I be doing to handle strings that include the & character?
Regards,
Mike