title: php class autoload - seems to be caching?
body: <p>I've recently implemented the following code to autoload classes in my php code:</p>
  
  <pre><code>function my_autoloader($class) {
      include 'classes/class_' . $class . '.php';
  }
  spl_autoload_register('my_autoloader');
  </code></pre>
  
  <p>The code is contained in file that gets included at the top of all files that need to generate a web page.  So then I set about removing the require_once calls from my code.  Here's an example:</p>
  
  <pre><code>require_once('classes/class_web_page.php');
  </code></pre>
  
  <p>As you'll probably gather from the above, the various pages on my site (it's an online community so there's a forum, gallery, etc) all use the web_page class to generate page headings, menus, etc.  The various pieces of code create a web_page object, set various parameters to determine what menu options etc are needed, give the page some content, and generate the html.</p>
  
  <p>All seemed well until I made a change to the class_web_page.php file.  The change was immediately apparent on most of the site... except for the home page.</p>
  
  <p>I refreshed my browser, switched if off an on again :-) tried calling <a href="http://www.terragenesis.co.uk/index.php" rel="nofollow">http://www.terragenesis.co.uk/index.php</a> rather than just <a href="http://www.terragenesis.co.uk/" rel="nofollow">http://www.terragenesis.co.uk/</a>, and even stopped and restarted apache on the server.  Despite all this the changes didn't show on the home page.  In the end I put the require_once line back into index.php... and presto hey: the changes I'd made in class_web_page.php appeared on the home page.</p>
  
  <p>So it looks to me like the autoloader was loading a cached copy of class_web_page.php and nothing, not even restarting Apache, was going to persuade it to get the new version.  Why it should do this for the home page and not the other pages... I have no idea.</p>
  
  <p>Has anybody else experienced this?  Have I done something wrong with the autoloader code?  How can I fix it... or am I going to have to put all the require_once statements back in place?  :-(</p>
  
  <p>My server has PHP version 5.1.6</p>