Trying to get up to speed on PHP.
I'm looking at a basic guestbook form and trying to recreate it with my style.
The original file has this line:
$tmpDir = getenv('TEMP');
I know variables in PHP do not have to be declared first (irritating, though that may be for me), and with a name like tmpDir
, it certainly sounds like some local, temporary variable.
So, I'm punching some of the code in using a trial version of Komodo because I'm hoping the Auto Complete features of it will help me learn the language a bit faster.
As soon as I get $t
typed in, Auto Complete shows me what is available.
So, $tmpDir
isn't just some local variable to this code?
How would a Dummy like me know this?
Komodo has a Go To Definition function, but when I do that in my original example, all it does is highlight the four instances of it in the code.
So, without having to go out there and memorize every global variable that PHP has, is there any way to know what is global and what is not?
I was not able to find $tmpDir
on php.net/manual either.
UPDATE:
superglobal is the keyword or PHP definition I missed. I was getting my familiar C# term global confused with PHP's term.
Given that, the answer is:
If PHP code were to use the superglobal variable
tmpDir
, then the PHP code would have to explicitly call $GLOBALS[tmpDir] to use it.
Thanks go to deceze and Wayne Whitty, though neither of them has put this into an answer. When one of them does, I will mark it.