Re: Procedural Autoloader?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The simplest solution would be to move those functions into static methods
of classes. Place one class in each file to organize your functions and use
an autoloader to load the classes. You don't need to instantiate the class
to use the autoloader--just reference it statically:

    // library/Math.php
    class Math {
        const PI = 3.14159;

        public static function sin($radians) {...}
    }

    ...

    $x = $radius * Math::cos(Math::PI * 0.5);

David

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux