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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация