I have the following string:
Name_Location_Telephone_break_Name_Location_Telephone_break_Name_Location_Telephone_break_Name_Location_Telephone_break_
I got this from a cURL of an HTML page using DOM.
My final result must be a JSON file like:
Shop 1: { name: "example", location: "example", telephone: "0123"}
Shop 2: { name: "example", location: "example", telephone: "0123"}
But I know that first I have to split the string, I tried this
$shops = explode("break",$result);
$values = array();
foreach ($shops as $shop) {
$values = explode("_", $shop);
foreach($values as $value) {
$name = $value[0];
$location = $value[1];
$tel = $value[2];
}
}
But it doesn't work. Can anybody help me?