Re: Procedural Autoloader?

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

 



On 22 November 2010 22:02, David Harkness <david.h@xxxxxxxxxxxxxxxxx> wrote:
> 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
>

Would it be overboard to use a namespace? Aren't namespaces handled by
the autoloader? If not autoload(), how about spl_autoloading?


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[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