View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000515 | mantisbt | feature | public | 2001-05-23 21:59 | 2003-12-13 04:48 |
Reporter | Assigned To | jlatour | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | won't fix | ||
Product Version | none | ||||
Summary | 0000515: Use of $g_***** for globals. | ||||
Description | Have you considered using some form of $GLOBAL[] array instead of all of the $g_**** variables? I have seen several scripts do this. It seems to make accessing the globals easier sinces all you have to do is tell the function about $GLOBAL[] instead of each of the variables individually. | ||||
Tags | No tags attached. | ||||
Mmm, the thought has crossed my mind. I believe there would be some resource/performance issues since the number of globals is pretty large. At least that was what I gathered from some discussion on the topic on phpbuilder.net. Plus the number of globals used is pretty small for most functions. One other thought was to put most everything into the database but that would potentially have serious performance problems. Eesh, I wish I knew exactly how php/databases would behave so I could know for certain the tradeoffs without having to have an entirely different branch to test on. BTW: were any of these scripts of any significant size? |
|
PHP Nuke uses that idiom in at least one place (the first file I opened) function FriendSend($sid) { Note that they have a array of all of the table names that they use in all functions that do queries. That way user's can easily change table names around in MySQL (since some hosting services only allow one database per account). I would have guessed the performance advantage would have gone the other way but I trust those who have timed it more than my gut ;-> My gut REALLY tells me that sticking it in the database will NOT be faster! Will check phpbuilder... |
|
This is no longer an issue with the introduction of config_api.php in 0.18.0 |
|