A
A
Alexey Medvedev2014-09-10 14:41:09
CMS
Alexey Medvedev, 2014-09-10 14:41:09

How to get rid of global variables in php?

So, I wrote CMS for a long time, there are language files, a settings file and a bunch of plug-in files with functions.
In a huge amount of code, global variables are written for the same language or some function settings.
Is there an alternative to global, or are there other PHP features?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-09-10
Protko @Fesor

How to get rid of global variables in php?

do not use global variables.
alternative - inversion of control, dependency injection.

M
Maxim Grechushnikov, 2014-09-10
@maxyc_webber

learn OOP, design patterns.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question