Well, I don't think this has anything to do with predefined variables being
global or not because I only have use for them within the specific methods.
The methods will capture their values and assign them to a variable inside
the function, which will return that variable at the end. The processing of
$PHP_SELF and $DOCUMENT_ROOT only happens in one place. I might be wrong,
not sure. But right now all I know is that I am confused and the link you
sent me didn't help explain what I need to know because it states no mention
of predefined variables. Can you perhaps give me an example of what you are
trying to tell me?

I read about variable scope and it says nothing about predefined variables.
So how will using the $_SERVER associate array help me with this? Remember
that globals is on, so I don't need to use $_SERVER, $_POST, $_GET, etc. to
get my values. But, in the meantime I'll go ahead and try using the
associate autoglobal arrays anyway, like $_SERVER, just to test it and to
see if it works for me. And if it does, it'll bug me until I find out why it
works. Thanks your input Philip. If anyone else has any thoughts or
explainations for me to understad this then that would be great.

>>
>>Read:
>>  http://www.php.net/variables.scope
>>
>>Also note that $_SERVER is an autoglobal.
>>
>>Regards,
>>Philip

> -----Original Message-----
> From: @ Nilaab [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 26, 2003 1:46 PM
> To: Php-General
> Subject: [PHP] Predefined Variables In Classes
>
>
> Hello Everyone,
>
> I am a little confused. Why do predefined variables like $PHP_SELF or
> $DOCUMENT_ROOT not process within a class, in the methods secifically. For
> example:
>
> <?php
> class someClass {
>
>    function someFunction () {
>       $root = $DOCUMENT_ROOT;
>       return $root;
>    }
>
>    function someFunction2 () {
>       $path = $this->someFunction() . $PHP_SELF;
>       return $path;
>    }
> }
> ?>
>
> I just threw this together to give you an example of how I might be using
> these two predefined variables in a class. The problem is that
> $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just
> returns blank.
>
> It is included in another page when needed, say somePage.php. Shouldn't
> $PHP_SELF recognize the somePage.php as the current running
> script file, as
> opposed to the class file where these two functions are called? If it
> doesn't work that way then how do I do this without sending predefined
> variable parameters to these functions?
>
> Please note that register globals is on. I could not find any
> documentation
> on this on php.net. Maybe someone can give me a hint of point it
> out for me
> on the documentation. Thanks.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to