PHP autoloading does not support functions. However it does work for static class methods:
namespace Foo;
abstract class Util
{
static function doSomething() {
}
}
You can then use
that class in some other files current namespace and call the static method:
use Foo\Util;
Util::doSomething();
As this is a class method and autoloading is for classes, this does work then.
Take care that the more correct way to group methods inside a namespace / class is probably making it final
Docs as well, however PHP does not support that (see Cannot create a final abstract classPHP Sadness #41).
You find this as well outlined in the following Q&A Material here on the site:
- Autoloader for functions - Jan 19 '11
- autoload functions in php - Nov 16 '10
- Does the PHP autoloader function also work with static method calls? - Jan 11 '10