What keyword is used in PHP to access a global variable inside a function?
- local
- global
- this
- super
To access a global variable inside a PHP function, the global keyword is used. By declaring global followed by the variable name within the function, you can access and modify the value of the global variable. This allows you to work with global variables within the function's local scope. Learn more: https://www.php.net/manual/en/language.variables.scope.php#language.variables.scope.global
Loading...
Related Quiz
- The $_POST superglobal in PHP is an associative array.
- You have a function in your PHP script that's supposed to return a value, but it's not returning as expected. How would you debug this?
- The value of a class constant in PHP can be changed after it is defined.
- Which of the following are ways to create a file in PHP?
- How can you get the current date and time in PHP?