PHP Hyper Global Array (superglobals) introduces _php instances

Source: Internet
Author: User
Overview

Want to be a public platform, read the official URL to access the sample code, found that there is a problem seems to have been half-known, is to use the $_get in the class directly. After a close look at the knowledge of this area, I found that the basic knowledge of this part of PHP is not very reliable.

Scope of the variable

Referring to the hyper-global array of PHP, it is not important to say the scope of the variable. The scope of a variable is a concept in any programming language and must be mastered. About the scope of variables in PHP, there is no more to say, you can view the information on their own.

Hyper-Global Array

A hyper-global array is a specially defined array variable in PHP that is referred to as a hyper-global array because the arrays are accessible anywhere in the script, in any scope, such as functions, classes, files, and so on.

The hyper-global array in PHP includes the following:
Copy the Code code as follows:
$GLOBALS
$_server
$_get
$_post
$_request
$_cookie
$_session
$_files
$_env

Attention

One thing to note is the difference between global variables and hyper-global arrays in PHP, where global variables are not directly accessible in classes.

Summarize

In the future, we should pay more attention to the basic knowledge and solve our doubts in time.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.