Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17558 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27755 invoked by uid 1010); 6 Aug 2005 12:31:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 27740 invoked from network); 6 Aug 2005 12:31:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2005 12:31:30 -0000 X-Host-Fingerprint: 195.225.34.5 unknown Received: from ([195.225.34.5:5002] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id BC/EE-04646-2ADA4F24 for ; Sat, 06 Aug 2005 08:31:30 -0400 Message-ID: To: internals@lists.php.net Date: Sat, 6 Aug 2005 14:30:57 +0200 Lines: 21 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 195.225.34.5 Subject: custom superglobals From: r.korving@xit.nl ("Ron Korving") Hi, Wouldn't it be a good feature to have users create their own superglobals? I think it would be good for at least two reasons (rather similar though): - Application settings can be stored in such a global, so that objects can use them without needing the information passed to functions or using the rather ugly "global" statement. - A singleton constructor could use it to grab information. Normally, in my own database abstraction layer, I would create the database object and pass the constructor information on where to connect. I don't want to implement my DB class to open a file to read connection information and I don't want it to use the "global" statement. This presents a problem if I want it to be a singleton object, because I'd need the information everytime I call getInstance() which is of course not really an option. Personally, I don't consider using a superglobal from within the constructor an ugly practice. Ron