PHP - performance and memory issue with global variables

后端 未结 2 486
陌清茗
陌清茗 2020-12-18 14:58

Hypothetical situation: I\'m running a complex site in php, and i use a lot of global variables.

i could store the variables in an existing global scope, say $

2条回答
  •  春和景丽
    2020-12-18 15:36

    Both are pretty bad. I would suggest using a singleton, or static classes.

    As for memory uses, there would be no noticable difference.

提交回复
热议问题