|
Posted by Andy Hassall on 06/19/06 23:19
On 19 Jun 2006 09:56:17 -0700, "Sonnich" <sonnich.jensen@elektrobit.com> wrote:
>I have an app which reads from certain servers, but I'd like to have
>them in am ini-file.
>
>I made this up, but I need those vars to be visible in functions
>too.... how do I do that?
Various options, some of which are:
(1) Access the configuration values through functions instead of globals.
(2) Define them as constants; they're always in scope.
(3) Use the "global" statement in the function.
(4) Reference the variables through $GLOBALS.
(5) It sounds like you want to register your own superglobals - this is not
trivial; runkit can do it, but that's fairly magic and unlikely to be installed
on most servers. http://www.php.net/manual/en/runkit.sandbox.php
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|