You need to access information about the server in your PHP script. How would you do this using a superglobal?

  • Use the $_SERVER superglobal.
  • Use the $_GET superglobal.
  • Use the $_POST superglobal.
  • Use the $_SESSION superglobal.
The correct option is 1. To access information about the server in PHP, you would use the $_SERVER superglobal. The $_SERVER superglobal provides an associative array containing information about headers, paths, and script locations. It gives access to details such as server name, request method, script filenames, and more. By accessing specific elements of the $_SERVER array, you can retrieve and utilize various server-related information in your PHP script. This information can be helpful for tasks like client IP detection, URL manipulation, or identifying server software. Learn more: https://www.php.net/manual/en/reserved.variables.server.php
Add your answer
Loading...

Leave a comment

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