I need to make big string into a nice array. String itself is list of tags and tag ids. There can be any amount of them. Here is example of the string: 29:funny,30:humor,2:lol – id:tag_name. Now, I have problem converting it to array – Array ( [29] => funny [30] => humor ). I can get to the part where tags are as so
Array (
[0] = Array (
[0] = 29
[1] = funny
)
[1] = Array (
[0] = 30
[1] = humor
)
)
I’ve look at array functions too but seems none of them could help me.
Can anyone help me out?
Here’s some code to get you going:
You could replace the foreach with an
array_mapfor example, but I think it’s simpler for you this way.Here’s an example of it working: http://codepad.org/4BpnCiEJ