i got a txt file with the following structure:
r= data0 n= data2 b= data 3 p= data4 s= data 5 h= data6 t= data7
r= data8 n= data 9 b= data10 p= data11 s= data12 h= data13 t= data14
r= data15 n= data16 b= data 17 p= data18 s= data19 h= data 20 t= data 21
i would have an array like this:
array {
[r]=> "data0"
[n]=> "data2"
[b]=> "data 3"
[p]=> "data4"
[s]=> "data 5"
[h]=> "data6"
[t]=> "data7"
}
for each row an array ... my code (i tried to explode the lines first - this worked, after that i would like to use a regex, didn't worked :D ):
$data = file_get_contents("../data/file.txt");
$data = explode("\n", $data);
foreach($data as $line) {
preg_match("/([a-z]=[^=]*\s*)*/", $line, $hit);
var_dump($hit);
}
can anyone help me? thanks a lot!
greets