NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
auto completion of $GLOBALS


Joined: 21 May 2007
Posts: 14
Location: Canada
Reply with quote
Would it be possible to auto complete keys within the $GLOBALS array. I know that typically you don't want to auto complete array keys because things would just get messy and slow, but the $GLOBALS array is often used for settings. When it is used like this, the settings are often defined in one file and then used throughout the site. Currently, you have to know exactly what keys are defined.

I'm thinking that it would only auto complete keys that are hard coded, not all the other variables that are added to the $GLOBALS array when the script executes.

Is this possible? Or is there a way to make this happen already with some phpdoc code?

Derril
View user's profileFind all posts by derrilSend private messageVisit poster's website
Veteran

Joined: 06 Mar 2007
Posts: 158
Location: Poland
Reply with quote
Maby not answer for Your question ... but why are You using $GLOBALS array?

It is not needed exactly and in fact it is not clear.

Take look at this codes:

final class GLOBALS
{
public static $displaymode;
public static $language;
// ... other globals
}

GLOBALS::$displaymode = 'somemode';
GLOBALS::$language = 'en';

function Test()
{
echo GLOBALS::$language;
}

You can set and get anything You need - with fully code completion Smile

_________________
ML
View user's profileFind all posts by introSend private messageVisit poster's website


Joined: 21 May 2007
Posts: 14
Location: Canada
Reply with quote
I did not recall that object variables are available globally. Originally we had used an object that was instatiated, but had to always make it global inside every function. I may have to reconsider my tactics.

It would still be nice to have $GLOBALS auto complete.
View user's profileFind all posts by derrilSend private messageVisit poster's website


Joined: 21 May 2007
Posts: 14
Location: Canada
Reply with quote
ML, you are right. I should not use $GLOBALS. Forgot that if I have a variable named $header and $GLOBALS['header'] then they are actually the same variable. $GLOBALS completion would be cool, but not necessary. Smile
View user's profileFind all posts by derrilSend private messageVisit poster's website
auto completion of $GLOBALS
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic