Home Forums PHP Static variable

Viewing 3 reply threads
  • Author
    Posts
    • #133
      krishna krishna
      Participant

      Can we make global static variable if yes then how?

    • #134
      vikas mishra
      Participant

      There really is no difference between a global variable and a public static variable. The class variable is namespaced a tiny bit better, but that hardly makes any difference. Both are accessible anywhere at any time and both are global state.

      As it happens, I just wrote an exhaustive article on the subject:
      How Not To Kill Your Testability Using Statics

    • #162
      softechquery
      Keymaster

      There really is no difference between a global variable and a public static variable. The class variable is namespaced a tiny bit better, but that hardly makes any difference. Both are accessible anywhere at any time and both are global state.

      As it happens, I just wrote an exhaustive article on the subject:
      How Not To Kill Your Testability Using Statics

    • #163
      softechquery
      Keymaster

      There really is no difference between a global variable and a public static variable. The class variable is namespaced a tiny bit better, but that hardly makes any difference. Both are accessible anywhere at any time and both are global state.

      As it happens, I just wrote an exhaustive article on the subject:
      How Not To Kill Your Testability Using Statics

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
Scroll to Top