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 <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to