You can use this:
$data = file_get_contents("../data/file.txt");
$lines = explode("\n", $data);
$result = array();
foreach ($lines as $line) {
preg_match_all('~([a-z])=\s*(.+?)\s*(?=[a-z]=|$)~', $line, $matches, PREG_SET_ORDER);
$tmp = array();
foreach ($matches as $m) {
$tmp[$m[1]] = $m[2];
}
$result[] = $tmp;
}
print_r($result);
an other way:
$json = preg_replace('~ +(?=[a-z]=)~', '","', $data);
$trans = array('= ' => '":"',
"\n" => '"},{"');
$json = '[{"' . strtr($json, $trans) . '"}]';
$result = json_decode($json, true);