title: Optional include in PHP
body: <p>I have a config file with the general configuration (in a git repo), and a local config file that overwrites configuration properties (ignored in the repo). Right now the local config file is included at the beginning of the config file:</p>
  
  <pre><code>include_once 'local_config.php';
  </code></pre>
  
  <p>But I would like the include to be conditional: only do it if the file local_config.php actually exists. I can do a <a href="https://stackoverflow.com/questions/9138444/using-php-include-during-conditional-statements" title="conditional include">enter link description here</a> without problems, but first I would need to check if the file exists. So I tried get_include_path() but it returns a list of paths, and I would have to parse this list and check for every one.</p>
  
  <p>Another option would be to just call include_once() and suppress the warnings, but it is even messier. Is there a simpler way to do a real optional include in PHP?</p>