By default, when you are inside a function, you do not have access to the outer variables. If you want your function to have access to an outer variable, you have to declare it as global, from inside the function.
But note that using global variables is not a good practice - with it, your function is not independent anymore.
About variable scopes and functions:
https://www.php.net/manual/en/language.variables.php
Kind regards, Andy
By default, when you are inside a function, you do not have access to the outer variables. If you want your function to have access to an outer variable, you have to declare it as global, from inside the function.
But note that using global variables is not a good practice - with it, your function is not independent anymore.
**About variable scopes and functions:**
https://www.php.net/manual/en/language.variables.php
Kind regards, Andy
https://net-twin.de/ Community for creative people - JOIN it Now please
https://github.com/WebCrew My GitHub account
https://sell-co.de/ Lots of Web-Tools and Utilities for free
edited Aug 30 '19 at 6:19 pm