so I have site structure like this. I have index.php, that includes() include.php, which includes functions.php and a bunch of other files.
What I want to do is write $GLOBALS["something"] = 'something here'; in functions.php and after do echo $something; in index.php so it would print something here, but for some reason it returns nothing. Where is my mistake?
so I have site structure like this. I have index.php , that includes() include.php
Share
In
index.phpyou either have to sayecho $GLOBALS['something']orglobal $something; echo $something;in order to register$somethingas a global variable.However, I would discourage using global variables at all and instead use constants if you have to.