<?php function __autoload($class) { $files = array('MyClass' => "/path/to/myClass.class.php", 'anotherClass' => "/path/to/anotherClass.class.php"); if(!isset($files[$class])) return; require_once($files[$class]); } $a = new MyClass; $b = new anotherClass; ?>