I have a page called house.php and a class in house.class.php. When I create an instace of that class in house.php it works. Now I want to make a chair.php file and a class Chair that extends House in house.class.php. Where should I put that class? spl_autoload_register doesn't find my class since its name isn't the same with the file. How can I improve function AutoloadClass ? Should I create a chair.class.php and use an require with house.class.php?
spl_autoload_register(null, false); spl_autoload_extensions('.php, .class.php'); function AutoloadClass($class){ $filename = $class.'.class.php'; if (!file_exists($filename)) { return false; } include $filename; } spl_autoload_register('AutoloadClass'); Thank you