> -----Original Message-----
> From: Ow Mun Heng [mailto:[EMAIL PROTECTED]
> Sent: 07 July 2003 04:34
>
> Here's My question, a variable is not actually global is not
> actually global until I make it global through "global
> $make_this_global"
> and then I can assess it using $GLOBAL[$make_this_global].
Not correct.
Variables used in the global scope are global, and appear in the $GLOBALS array as
soon as they come into existence. A global statement is used within a function merely
to declare that you wish to use one of those variables in that function, where it
would otherwise not be available. It's sort of equivalent to saying "when I use
variable $x in this function, I actually want it to be $GLOBALS['x']" -- or, in PHP
terms, $x = &$GLOBALS['x'].
>
> Another method would be to "global"ise it on demand by writing a
> little function. (like Rasmus)
>
> I did it like this -->
>
>
> ---create_globals.php------------
> function create_global($passed_variable)
> if (isset ($GLOBALS[$passed_variable]))
> {
> return $GLOBALS[$passed_variable];
> }
> ---------------end-----------------
>
> --------config.php------------------
> $page_title = "Page Title of Web Page"
> ---------end------------------------
>
> ----------index.html----------------
> require_once ('create_globals.php');
>
> $local_variable = create_global( 'main_title')
> echo "My Page Title is".$local_variable;
> --------------end---------------------
>
>
> Hence This way I can make it global-on-demand.
>
> Maybe a better way to do it would be to
>
> ---------------config.php-----------
> global $page_title = "Alternative Way"
> ----------------end-----------------
I'm really not sure what you're getting at here, but I think it may be based on a
misunderstanding. If you could explain exactly what it is you're trying to do,
someone might be able to offer some better help.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php