Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only
| From: | Larry Garfield | Date: | Fri, 10 Dec 2010 01:43:40 +0000 |
| Subject: | Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50989@lists.php.net to get a copy of this message | ||
On Thursday, December 09, 2010 4:44:44 am Michael Shadle wrote:
> On Thu, Dec 9, 2010 at 2:38 AM, Andrey Hristov <php@hristov.com> wrote:
> > Yes, as the documentation will mention how to do it, for old
> > applications. For new apps it is easy - pass all the information you
> > need as parameter to the function. It works in other languages, why
> > shouldn't it work for PHP?
>
> named parameters would help here. otherwise you wind up with a mess of
> argument hell. or passing a single array in and then in the function
> parsing that for the items (which is what I do, sort of a userland way
> of doing named parameters)
>
> but adding more and more parameters to functions over time leads to
> issues if they do not have default values and if you have to pass say,
> the 6th parameter, but don't need to pass the rest, etc.
It seems like something like this bundled by default could provide an
alternative to the super-globals:
http://us3.php.net/manual/en/book.http.php
Note: I have not actually used said library, just drooled over having a
properly abstracted HTTP object for incoming and outgoing communication.
--Larry Garfield