[SOLVED] Parse data from string "name:john email:[email protected] id:123456"


Basically, what I want is to access the data between substrings (between “name:” and “email:”, for example)

What’s the best way of doing this?


you can first explode on space…

 $array  = explode(' ',$string);

and then explode on : while looping through….

 foreach($array as $arr){
     $temp = explode(':',$arr);
     echo $temp[1]; // your value here 

Answered By – Brandon Frohbieter

Answer Checked By – David Goodson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *