title: foreach, explode and keeping data in same array
body: <p>I am trying to convert my example_data to be in the same array:</p>
  <pre><code>$example_data = &quot;FirstName=Test&amp;LastName=TestLastName&amp;Address=ExampleSt&quot;;
  $explode1 = explode('&amp;', $example_data);
  
  $data_array = array();
  foreach ($explode1 as $values)
  {
      $explode2 = explode(&quot;=&quot;, $values);
  
      $field_name = $explode2[0];
      $field_value =  $explode2[1];
  
      $data_array[] = array(
          $field_name    =&gt;    $field_value
          );
  }                
  
  echo json_encode($data_array); 
  </code></pre>
  <p>The current output - separated arrays:</p>
  <blockquote>
  <p>[{&quot;FirstName&quot;:&quot;Test&quot;},{&quot;LastName&quot;:&quot;TestLastName&quot;},{&quot;Address&quot;:&quot;ExampleSt&quot;}]</p>
  </blockquote>
  <p>The intended output I am looking for:</p>
  <blockquote>
  <p>{&quot;FirstName&quot;:Test,&quot;LastName&quot;:TestLastName,&quot;Address&quot;:ExampleSt}</p>
  </blockquote>