$variable = '
    persons.0.name = "peter"
    persons.0.lastname = "griffin"
    persons.1.name = "homer"
    persons.1.lastname = "simpsons"';
I want to generate from that $variable an array that looks like this
array(2) {
  [0]=>
  array(2) {
    ["name"]=>
    string(5) "peter"
    ["lastname"]=>
    string(7) "griffin"
  }
  [1]=>
  array(2) {
    ["name"]=>
    string(5) "homer"
    ["lastname"]=>
    string(7) "simpson"
  }
} 
so far this is what I have so far.
$temp = explode('\r\n', $persons);
$sets = [];
foreach ($temp as $value)
{
    $array = explode('=', $value);
    if ($array[0] != '')
    {
        $array[1] = trim($array[1], '"');
        $sets[$array[0]] = $array[1];
        $output = $sets;
    }
}
that generates "persons.1.name" as a key and "peter" as a value I´m not sure how to generate arrays based on "." thank you.
I tried with parse_ini_string() but basically is doing the same thing.
 
     
     
    