Reply to Re: Variables Outside Functions

Your name:

Reply:


Posted by Perttu Pulkkinen on 06/02/05 15:13

"Angelos" <angelos@redcatmedia.net> kirjoitti viestiss�
news:d7mmmg$ben$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
> hello there...
> I would like to ask if there is any way of using variables which are
outside
> functions in the functions without passing them when I call the
function...
> Complicated eehh ?
> ANd the question is : DO I have to pass all the variables that I use in
the
> function when I call it ?
> I don't want to set the variables inside the functions because they are
used
> by other functions as well

1) and you remember that GET is already superglobal, so no problem with that
2) MUCH better than "globalizing" individual vars from here and there is to
make one $CFG-variable or object that is collection of those vars that are
allowed to globalize from coder's point of view
3) of course i understand and appreciate those who say: don't use any global
in fuctions. But wise $CFG doesnt't create problems.

class o() {};
$CFG=new o();
$CFG->body ="DFSDFGSDF";
$CFG->head ="aertaertaer";
function some()
{
global $CFG;

$CFG->body = "<html>....</html>";

}

[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

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