Reply to Re: How to add (or emulate) a new superglobal

Your name:

Reply:


Posted by Erwin Moller on 02/07/07 10:46

P Pulkkinen wrote:

> This is just for curiosity, but:
>
> Lets say I would like to have a new superglobal, in addition to
> automatically made get, post, cookie and session.
>
> I mean, I would (theoretically) want to AVOID doing
>
> function ()
> {
> global $config;
> ....
> }
>
> and just be able to use $config in functions and classes.
> Not that it would be the nicest practise though. But let's say for the
> sake of fun or doing it.
>
> Is there a way? Of course you could reset, set and reset again some
> session variable, but that would not be very nice way.

Why not simply throw your stuff in $GLOBALS?

Something like this:
$myVars = array('nr1' => 123, 'nr2' => "bla");
$GLOBALS[] = $myVars;

It should have the same effect. I think.

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация