Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50944 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4279 invoked from network); 9 Dec 2010 12:27:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2010 12:27:58 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Linux 2.6 Received: from [78.32.209.33] ([78.32.209.33:60643] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/21-32433-D4BC00D4 for ; Thu, 09 Dec 2010 07:27:58 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.63) (envelope-from ) id 1PQfb9-0007U1-Kb; Thu, 09 Dec 2010 12:27:47 +0000 Date: Thu, 9 Dec 2010 12:27:47 +0000 To: Andrey Hristov Cc: Ferenc Kovacs , PHP Internals List Message-ID: <20101209122747.GO22675@phcomp.co.uk> Mail-Followup-To: Andrey Hristov , Ferenc Kovacs , PHP Internals List References: <4D00ABFE.5070403@hristov.com> <4D00C86D.70208@hristov.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D00C86D.70208@hristov.com> User-Agent: Mutt/1.4.2.2i Organization: Parliament Hill Computers Ltd Subject: Re: [PHP-DEV] Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only From: addw@phcomp.co.uk (Alain Williams) On Thu, Dec 09, 2010 at 01:15:41PM +0100, Andrey Hristov wrote: > no, you got me wrong. I will repeat - global variables won't cease to > exist, but $GLOBALS and "global" as means to access them should be > removed. If a function needs data it should get it passed to it. By & large yes, but in small/medium scripts it can be really useful to have things like a globally scoped $dbh - so it doesn't clutter up function calls. Yes: if the script grows to the point where it needs more than one database handle then the script will need to be refactored, but for huge numbers of scripts that will never be the case. If you ban global variables people will just bung the values into $_SESSION to get the same effect -- that would be even worse! -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include