Jump to content

split string


anujgarg

Recommended Posts

I have a string looks like:

123, 234: 333, 444: 555, 666: 111, 222

 

I want to separate this string from each colon, like:

123, 234

333, 444

555, 666

111, 222

 

I could use split for the same purpose, but this string can have multiple colons (:) as this is being generated dynamically. For this, I have to count total number of colons (:) first, then to split.

How can I do this? Or there is any other method to do it?

 

TIA

Link to comment
https://forums.phpfreaks.com/topic/126235-split-string/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.