I hope you're doing great. So, I've been working on some PHP code and I'm facing a small issue. I have some variables declared outside of a function, which I need to access within that function. However, I'm not sure how to do it.
To provide some context, the reason I have these variables declared globally is that they are used in multiple functions throughout my script. But now I need to modify their values within a specific function.
I've tried simply using the variable name within the function, assuming that PHP would automatically recognize the global scope. However, that didn't work as expected. The function seems to create a local variable with the same name instead of accessing the global one.
I'd greatly appreciate it if someone could guide me on how to access these global variables within my function. Is there a specific syntax or keyword I should be using? Or perhaps there's another approach I should take?
Thanks in advance for your help!