Can spl_autoload be placed in another file?
<p>I'm currently making my first website with PHP. Rather than writing autoload for each individual page, I wish to create one file with a general autoload ability. </p>

<p>Here is my <code>autoloadControl.php</code>:</p>

<pre><code>// nullify any existing autoloads
spl_autoload_register(null,false);

//specify extensions that may be loaded
spl_autoload_extensions('.php. .class.php');

function regularLoader($className){
    $file = $className.'.php';
    include $file;
}

//register the loader function
spl_autoload_register('regularLoader');
</code></pre>

<p>Here is my <code>index.php</code> file:</p>

<pre><code>require("header.php");
require("autoloadControl.php");

$dbConnection = new dbControl();
$row=$dbConnection-&gt;getLatestEntry();
</code></pre>

<p>Currently, the <code>$dbConnection = new dbControl()</code> gives me the following error:</p>

<blockquote>
  <p>Fatal error: Class 'dbControl'</p>
</blockquote>

<p>So my question is, is there a way to use autoload this way or must I place it at the top of every PHP file I write that uses another file?</p>
