I am trying to work some magic, and match a string.

Not using default matching but something like this:

<?php

$string = 'data:1,2,3,4,5;data:4,6,8,2,3';

// magic

foreach($matches as $match){
echo $match;
}

?>

And this would echo this:

1,2,3,4,54,6,8,2,3

Is this possible?

share
I didn't get you, what you want... – Sumit Bijvani 7 mins ago
Basically to loop through $string and fetch the content in between every "data:" and ";", and organize it into an array. – Sam Kalvin 6 mins ago
ok so you want this output 1,2,3,4,54,6,8,2,3 ? – Sumit Bijvani 5 mins ago
Yes, that's exactly what I'm aiming for – Sam Kalvin 5 mins ago
so why don't you try str_replace? – Sumit Bijvani 4 mins ago
show 3 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.