Hello i have a text file in which i record some arrays with output of print_r as below
$filename = 'record.txt';
$fp = fopen($filename, 'w');
$arr = [['MODEL' => 2011, 'BRAND' => 'FIAT'], ['MODEL' => 2017, 'BRAND' => 'MERCEDES']];
fwrite($fp, print_r($arr,true));
fclose($fp);
the output of this file is like this:
Array
(
[0] => Array
(
[MODEL] => 2011
[BRAND] => FIAT
)
[1] => Array
(
[MODEL] => 2017
[BRAND] => MERCEDES
)
)
now i want to read it back and use it as array. Is there any simple way to parse this string.