Hi Devs,
is there a possibility to get a php function like
declare_superglobal($_MYVAR);
And then be able to use $_MYVAR as the
existing superglobals ($_GET, $_SESSION, etc.) ???
I think, it would be a really nice feature!
Is that a huge problem to get this work?
Regards,
Matthias
Hi,
This has been discussed in the past (see the archives of either this list
or engine2).
You'll have to manage with the existing ones.
Andi
At 09:21 PM 8/23/2003 +0200, Matthias Nothhaft wrote:
Hi Devs,
is there a possibility to get a php function like
declare_superglobal($_MYVAR);
And then be able to use $_MYVAR as the
existing superglobals ($_GET, $_SESSION, etc.) ???I think, it would be a really nice feature!
Is that a huge problem to get this work?Regards,
Matthias
Matthias Nothhaft wrote:
declare_superglobal($_MYVAR);
Has one single superglobal $_APP (or $_USER or the like) already been
discussed? (Sorry Andi, couldn't find it in this list and didn't find
the 'engine2' list you were referencing at all).
I second Matthias that some sort of user-controlled superglobal would be
useful in frameworks, even if it was only one.
Stefan Walk wrote:
global $_MYFW;
I consider global the worst option ever as is has to be repeated inside
every function. Redundant and bug prone.
$GLOBALS['_MYFW'] is a bit better but very ugly and a pain to use.
Timm Friebe wrote:
MYFW::getInstance()->method_a();
Very clumsy. There's a reason why I'm not using Java! (-:C
And no, it does not work with PHP4 and excuse me, but PHP5 is far from
being deployed at your friendly ISP. Don't fool yourselves, PHP4 will be
around (and has to be supported by people writing PHP frameworks) for
quite a while.
An $_APP superglobal wouldn't allow multiple frameworks to coexist but I
think there'd be enough uses to justify it.
It'd for example allow me to turn $_REQUEST into an object, i.e. I could
use $_APP->id instead of $_REQUEST['id'] which is so much nicer to use.
And no, I don't use form variables with names that aren't valid PHP
identifiers ;-). The abuse of $_SESSION for this was already condemned
and I'd be uncomfortable to use $_REQUEST (or one of it's siblings) itself.
Ok, ready to take the beating,
- Chris