H
H
hrvasiliy2015-10-10 16:19:43
PHP
hrvasiliy, 2015-10-10 16:19:43

How to connect variables correctly?

The application works on MVC technology. On my site, index.php connects bootstrap.php, and the latter, in turn, connects the base classes (the example is taken from Habr), in addition, I decided to include the settings file (database name, database password, etc.). It turns out that these settings are available from any file on the site, quite conveniently. I declared the settings as constants, everything worked fine, now I tried to use just a variable. When trying to access this variable from other files - an error (undefined variable).
Why can I access the content when using constants, but not when using variables?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivanq, 2015-10-10
@Ivanq

I don't know for sure, but maybe it's a matter of appearance. Constants are visible everywhere, local variables are not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question