PHP Hyper Global Array

Source: Internet
Author: User
Tags arrays variable scope

This article mainly introduced the PHP Super Global Array (superglobals) Introduction, this article explained the outline, the variable scope, the Super Global array and the attention matter and so on content, needs the friend to be possible to refer to under

Overview

Want to do a micro-letter public platform, read the micro-letter official URL access to the sample code, found that there is a problem seems to have been half known, is in the class inside the direct use of $_get. After a careful look at this knowledge, found that the basic knowledge of PHP is not very reliable.

Scope of variables

Referring to the hyper-global array of PHP, we cannot help but say the scope of the variable. The scope of a variable is a concept that must be mastered in any programming language. About the variable scope in PHP, there is no more to say here, you can view the data yourself.

Super Global Array

A hyper-global array is a specially defined array variable in PHP, and is called 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:

The code is as follows:

$GLOBALS

$_server

$_get

$_post

$_request

$_cookie

$_session

$_files

$_env

Attention

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

Summarize

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

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.