title: Include php files only when needed at runtime
body: <p>I have some PHP code which looks roughly like this</p>
  
  <pre><code>require_once 'cache.php';
  require_once 'generator.php';
  
  if (cache_dirty ('foo')) {
      cache_update ('foo', generate_foo ());
  }
  
  print cache_read ('foo');
  </code></pre>
  
  <p>My problem is that <code>generator.php</code> includes a whole mass of libraries and I don't want to load/parse it unless <code>cache_dirty</code> actually returns <code>false</code> at runtime.</p>
  
  <p>I know there are PHP precompilers which can help but for now I need a quick fix. Is this possible?</p>