Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43211 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95746 invoked from network); 27 Feb 2009 06:08:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2009 06:08:24 -0000 Authentication-Results: pb1.pair.com header.from=karpeles@ookoo.org; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=karpeles@ookoo.org; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ookoo.org designates 88.191.88.38 as permitted sender) X-PHP-List-Original-Sender: karpeles@ookoo.org X-Host-Fingerprint: 88.191.88.38 lamune.ookoo.org Linux 2.6 Received: from [88.191.88.38] ([88.191.88.38:36594] helo=Lamune.ookoo.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9D/00-29220-65387A94 for ; Fri, 27 Feb 2009 01:08:24 -0500 Received: (PMaild MTA 372703 on Lamune.ookoo.org processing mail to pair1.php.net); Fri, 27 Feb 2009 07:08:24 +0100 Received: (PMaild 372702 invoked for remote email internals@lists.php.net); Fri, 27 Feb 2009 07:08:12 +0100 Received: from [192.168.0.25] (30.3.207-77.rev.gaoland.net [77.207.3.30]) by Lamune.ookoo.org (pMaild); Fri, 27 Feb 2009 07:08:12 +0100 Received: SMTP authenticated user logged in; a2FycGVsZXNAb29rb28ub3Jn; Fri, 27 Feb 2009 07:08:12 +0100 To: viroteck@viroteck.net Cc: internals Mailing List In-Reply-To: References: Content-Type: text/plain; charset=UTF-8 Organization: ooKoo.org Date: Fri, 27 Feb 2009 07:08:11 +0100 Message-ID: <1235714891.4443.134.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Class names (with regard to autoload) From: karpeles@ookoo.org ("M." =?ISO-8859-1?Q?Karpel=E8s?=) 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