title: Writing values to INI file
body: <p>I'm trying to store multiple data and then at the end go a head and push the data into the new .ini file. I found solutions which works but I want to get all the data first and then update the file at the end but the solutions i found updates the file straight away!</p>
  
  <p>A solution I liked and worked is located: <a href="https://stackoverflow.com/a/36997282/6613233">https://stackoverflow.com/a/36997282/6613233</a></p>
  
  <p>I am trying to allow it gather information and then push it to the file at the end. My own attempt at this is below but i keep getting array array in my ini file.</p>
  
  <p>Code:</p>
  
  <pre><code>$fbsettingsDB = parse_ini_file("location.ini", true);
  $fbsettingsDB["id"]["value"] = $_POST['fbconfigid'];
  $fbsettingsDB["location"]["value"] = $_POST['fbconfigcty'];
  file_put_contents('location.ini', implode("\n", $fbsettingsDB));
  </code></pre>
  
  <p>The above is how I want to collect data. I have a bunch of code which goes in and out of statements, I want it to go ahead.. Assign the values required and at the very end go ahead and put the contents in the file like shown above.</p>
  
  <p>Using the referred code i would then have to do:</p>
  
  <pre><code>config_set("location.ini", "id", "value", $_POST['fbconfigid']);
  config_set("location.ini", "location", "value", $_POST['something']);
  config_set("location.ini", "result", "value", $_POST['somethingelse']);
  </code></pre>
  
  <p>Which overwrites the file every time which in my opinion is just crazy! Overkill for my idea, there is obviously some way that can suit my needs so i can just call the function once after making a list of edit/changes and then when i call the function it grabs all my changed data and saves the file the way i want it!</p>