1

I'm new to PHP, but one thing that puzzled me is that many people do not recommend the use of global variables in PHP for website development (e.g. Wordpress). People talk about 'polluting' memory and things like that. If using global variables is really that bad, why was it then introduced in the first place?

What are cases when the use of global variables is generally accepted?

ralphjsmit
  • 316
  • 1
  • 9
  • I already searched for use of global variables and I also came across articles where they talked about variables in applications and software, so I thought I would just add it. I do not know all places where PHP is used. – ralphjsmit May 11 '20 at 10:00
  • If you write a web site in PHP, you're writing a web _application_. So when they talked about applications, it includes web development. – Magnus Eriksson May 11 '20 at 10:01

0 Answers0