In PHP, $GLOBALS is a superglobal array that contains references to all ______ that are currently defined in the global scope of the script.

  • Global variables
  • Local variables
  • Static variables
  • Super variables
The correct option is 1. In PHP, the $GLOBALS superglobal is an associative array that contains references to all global variables that are currently defined in the global scope of the script. It provides a way to access and manipulate these global variables from anywhere within the script. The keys of the $GLOBALS array correspond to the variable names, and the values are references to the corresponding variables. By accessing specific elements using their names as keys in the $GLOBALS array, you can retrieve or modify the values of global variables. It is important to note that using global variables extensively can lead to code complexity and potential issues, so it is recommended to use them judiciously and consider alternative approaches for better code organization and maintainability. Learn more: https://www.php.net/manual/en/reserved.variables.globals.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *