When do I use static variables/functions in php?

前端 未结 8 1016
天涯浪人
天涯浪人 2020-11-30 20:32

I am refreshing myself on OOP with PHP and I saw an example of setting functions and/or variables as static. When and why would I set a variable/function to static? I\'ve

8条回答
  •  独厮守ぢ
    2020-11-30 21:01

    If you want to share data with all instances, like counter for number of instances created on current execution .

提交回复
热议问题