Jump to content

Recommended Posts

G'day all,

 

I'm a PHP newbie (been an ASP programmer for years) and am trying to split a string of data up so I can use the individual pieces.

 

The data looks something like this :

 

2013-04-07 15:59:15,895~2013-04-07 16:01:15,897~2013-04-07 16:02:25,893

The split character is the tilde (~). 

 

I then wish to iterate through each item, split the item on the comma, and use the 2 values in a web page.

 

I've tried to use preg_split and explode, but just can't get it going - any and all help would be much appreciated.

 

Cheers.

Link to comment
https://forums.phpfreaks.com/topic/276633-preg_split-and-explode-help-needed/
Share on other sites

The easiest solution here would be to just use explode (twice), and a simple foreach loop.

Also, since you didn't post what you've tried I cannot tell you why it's wrong. So please post your attempts at solving this, so that we can guide you on how to properly do it.

Edited by Christian F.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.