Re: Class names (with regard to autoload)

From: Date: Fri, 27 Feb 2009 06:08:11 +0000
Subject: Re: Class names (with regard to autoload)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-43211@lists.php.net to get a copy of this message
Le jeudi 26 février 2009 à 20:27 +0000, Robin Burchell a écrit : > I've been playing around with autoload lately, and specifically using > autoload to load classes which may be in subdirectories. I came up > with the following test script: The best solution for you is to wait for PHP 5.3.0, then use: function __autoload($class) { $path = CLASSES_DIR . '/' . str_replace($class, '\\', '/', $class) . '.class.php'; include($path); } Namespaces are probably the best way to achieve this (apart from using _). Mark

« previous php.internals (#43211) next »