melbfella Posted April 7, 2013 Share Posted April 7, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/276633-preg_split-and-explode-help-needed/ Share on other sites More sharing options...
Christian F. Posted April 7, 2013 Share Posted April 7, 2013 (edited) 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 April 7, 2013 by Christian F. Quote Link to comment https://forums.phpfreaks.com/topic/276633-preg_split-and-explode-help-needed/#findComment-1423368 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.