Variables_order in PHP

Source: Internet
Author: User
Tags uppercase letter

$_env in PHP is an array that contains server-side environment variables. It is a super global variable in PHP, and we can access it directly from anywhere in the PHP program.

$_ENV just passively accepts server-side environment variables and transforms them into array elements, you can try to output it directly.

When you want to see what's inside a variable, there are three ways I know it:
1, Var_dump ($_env);
2, Print_r ($_env);
3. foreach ($_env as $key = $val) {echo $key. ' --------'. $val. ' <br> ';}
Of the three ways, the first one I found most convenient and the output content format is clear.

Since the $_env variable is dependent on the environment variables of the server, the result of $_env variables obtained from different servers may be completely different. So the complete list cannot be listed like $_server. The following are the more common elements that the $_env array contains:

Sometimes, $_env is empty, and the reason for this is usually the configuration file for php php.ini: variables_order = "GPCs". To make the value of $_env not be empty, then the value of Variables_order should be prefixed with an uppercase letter "E", i.e. Variables_order = "egpcs".

The above configuration represents the source and order of external variables accepted by PHP, EGPCS is the abbreviation for environment, Get, Post, Cookies, and server. If E is missing from Variables_order's configuration, then PHP cannot accept the environment variable, then $_env is empty.

Due to the opening of $_env, that is Variables_order = "egpcs" will cause some performance loss, according to the official PHP is, in the production environment, is not recommended to use. They are more recommended to use the getenv (string $varname) function to get the value in environment, which needs to be noted during programming. If you are programming with $_env and Variables_order is not configured as Variables_order = "Egpcs", the program may run with an error.

Variables_order in PHP

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.