How to realize class without include?

Assuming that I have a code like this:

<?php
class user_controller extends controller {

}

?>

controller is a class, and putted in somewhere. How do I do? Don’t need include to use this class as below:


<?php
    include('somewhere/controller.php');

    class user_controller extends controller {
        
    }
?>&#65279;

http://php.net/manual/en/language.oop5.autoload.php

Thanks so much!

Apart from that, you might want to have a look at libraries that provide class loading for you and make it easy to load classes from other projects, too. See http://getcomposer.org/doc/01-basic-usage.md#autoloading or http://symfony.com/doc/2.0/components/class_loader.html for example.

Thanks. It’s very helpful!