Which type of variable in PHP is accessible anywhere in the script?
- Local
- Global
- Static
- Super
In PHP, a global variable is accessible anywhere in the script. It can be accessed from within functions, outside functions, and across different files. Global variables have a global scope, meaning they can be accessed and modified from any part of the script. However, it's generally recommended to use global variables sparingly and follow good programming practices to avoid potential issues. Learn more: https://www.php.net/manual/en/language.variables.scope.php#language.variables.scope.global
Loading...
Related Quiz
- How are the keys assigned in an indexed array in PHP?
- What can be potential issues when working with the $_POST superglobal in PHP?
- What is the purpose of the unset() function in PHP?
- In a PHP do...while loop, where is the condition tested?
- In a PHP loop, break will ______ the loop, while continue will only skip the current iteration and proceed with the next one.