title: Zend application.ini
body: <p>I'd prefer to use native php for Zend configuration.
  How would I convert this Zend application.ini segment into php?</p>
  
  <pre><code>[development : production]
  </code></pre>
  
  <p>production section supposedly inherits from development section.
  P.S we are talking about ZEND framework here.</p>
  
  <p><strong>Update:</strong> Looks like I wasn't clear with my question.</p>
  
  <p>All I wanted to know was how Zend_Application handles inheritance/nesting in php options file comparing to ini or xml.</p>
  
  <p><strong>INI config example</strong> 
  (everything in production section will be inherited by testing and development section):</p>
  
  <pre><code>[production]
  autoloaderNamespaces[] = "My_"
  bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
  bootstrap.class = "Bootstrap"
  
  [testing : production]
  bootstrap.class = "productionBootstrap"
  
  [development : production]
  bootstrap.class = "developmentBootstrap"
  </code></pre>
  
  <p><strong>XML config example</strong> 
  (everything in production section will be inherited by staging section, note extends keyword):</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configdata&gt;
      &lt;production&gt;
          &lt;webhost&gt;www.example.com&lt;/webhost&gt;
          &lt;database&gt;
              &lt;adapter&gt;pdo_mysql&lt;/adapter&gt;
              &lt;params&gt;
                  &lt;host&gt;db.example.com&lt;/host&gt;
                  &lt;username&gt;dbuser&lt;/username&gt;
                  &lt;password&gt;secret&lt;/password&gt;
                  &lt;dbname&gt;dbname&lt;/dbname&gt;
              &lt;/params&gt;
          &lt;/database&gt;
      &lt;/production&gt;
      &lt;staging extends="production"&gt;
          &lt;database&gt;
              &lt;params&gt;
                  &lt;host&gt;dev.example.com&lt;/host&gt;
                  &lt;username&gt;devuser&lt;/username&gt;
                  &lt;password&gt;devsecret&lt;/password&gt;
              &lt;/params&gt;
          &lt;/database&gt;
      &lt;/staging&gt;
  &lt;/configdata&gt;
  </code></pre>
  
  <p><strong>PHP config example</strong> 
  No inheritance/nesting?
  Is there a way to make inheritance/nesting work without doing manual array merging?</p>
  
  <pre><code>return array(
      'production' =&gt; array(
           $test1 =&gt; 'aaaaaaa'
       ),
      'staging' =&gt; array(
          $test2 =&gt; 'bbbbbb'
      ),
      'testing' =&gt; array(
          $test3 =&gt; 'bbbbbb'
      )
  
  )
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>In retrospect - just wanted to add that there are certain advantages to using php arrays instead of ini files for configuration:
  <a href="http://www.dasprids.de/blog/2009/05/08/writing-powerful-and-easy-config-files-with-php-arrays" rel="nofollow">some info</a></p>
  
  <p>· they can be cached by an opcode cache</p>
  
  <p>· they support constants</p>
  
  <p>· they allow to create easily readable config trees</p>
  
  <p>· they support boolean and integer values</p>