title: Dynamically write defines in PHP settings file
body: <p>I have a PHP configuration file which stores settings like:</p>
  
  <pre><code>  define("SETTING_1", "");
    define("SETTING_2", "");
    define("SETTING_3", "");
  </code></pre>
  
  <p>By default the settings are empty, but then I have an installer file <code>install.php</code> which basically prompts the user for the settings. What is the best way to open the settings file, find the define for each setting and insert the value? Finally, need to save the settings file to disk.</p>
  
  <p>I want to ovoid using regular expressions or simple string search. I came across <code>token_get_all()</code>, does it makes sense to use it?</p>