The ______ keyword is used in PHP to make a local variable accessible globally.
- local
- global
- this
- super
The global keyword in PHP is used to make a local variable accessible globally. By using the global keyword followed by the variable name within a function, you can access and modify the value of the variable globally, outside the function's local scope. This allows you to work with local variables in a wider scope. However, it is generally recommended to minimize the use of global variables for better code organization and maintainability. Learn more: https://www.php.net/manual/en/language.variables.scope.php#language.variables.scope.global
Loading...
Related Quiz
- What is an indexed array in PHP?
- PHP scripts are enclosed within ______ tags.
- How can you encode a PHP array into a JSON object?
- To access an element of a multidimensional array in PHP, you use the name of the array followed by the ______ of the element in square brackets.
- A constant in a PHP class is defined using the const keyword.