This article is about the difference between hyper-global variables $globals and Global in PHP.
One, super global variable $globalsThere are many PHP hyper-global variables, such as the following are super
Static global variable: is the variable that can be used for methods in the current. M. Each time the call is invoked, the result of the last call is automatically used. Because only one memory address is allocated in the static allocation area, the numeric value is sliding scale.Static local variables: the same as global var
A static member of a class, which is shared by all objects, is allocated at the start of the process, and is then fixed without allocating space.
The difference between a static member variable of a class and a global variable outside the class is that you can set an access flag to allow only object access to the class. If you define static variables for public in a class, then there is no difference betwe
Php static variables _ php static variables and global static variables examples
Function test ()
{
Static $ var = 5; // static $ var = 1 + 1; an error is returned.
$ Var ++;
Echo $ var .'';
}
Test (); // 2
Test (); // 3
Test (); // 4
Echo $
Ruby is filled with a series of hidden variables, and we can get some interesting information from these predefined global variables.
Global process variables
$$ represents the currently running Ruby process.
Copy Code code as follows:
>> $$
=> 17170
We
Transferred from: http://www.jb51.net/article/48802.htmRuby is filled with a series of hidden variables, and we can get some interesting information from these pre-defined global variables. Global process variables$$ represents the currently running Ruby process.>> $$= 17170
Ruby is filled with a series of hidden variables. We can get some interesting information from these predefined global variables.
Global process variable
$ Indicates the currently running ruby process.Copy codeThe Code is as follows: >>$ $=> 17170We can kill ourselves from the current process.Copy codeThe Code is as fo
Believe that a lot of students from c++/java/c# and so on, may make such a mistake:
Outside a large for loop, write a lot of code after, but also a loop, we do not want to throw another I, we in other languages are so dry, but in PHP this way, you will find that the code into a dead loop! What is the reason?
The original for statement is not a function, just a statement form, in PHP, two I are treated as global
The difference between global variables $ GLOBALS and global in PHP. This article shares the differences between Super global variables $ GLOBALS and global in PHP. 1. there are many Super glo
A project created using MFC is composed of many files. It cannot define global variables as in General C ++ programs, to define global variables and functions that can be shared by multiple files in the project, you must use some special methods. There are actually many ways to implement it. Here we only introduce two
A project created using MFC is composed of many files. It cannot define global variables as in General C ++ programs, to define global variables and functions that can be shared by multiple files in the project, you must use some special methods. There are actually many ways to implement it. Here we only introduce two
When you define variables inside a function, they have nothing to do with other variables that have the same name outside the function, that is, the variable name is local to the function, which is called the scope of the variable, as an example:def func_local (x): print ' x is ', x x = 2 "print ' chanaged local x to ', XX = 50func_local (x)" print ' x is still ', XExecution Result:X is 50Chanaged
This article mainly introduces the PHP global variable and the Super global variable Difference, the detailed analysis tells the PHP global variable and the Super global variable concept, the usage and the use difference, the need friend can refer to the next
This paper analyzes the difference between PHP
Global variables: At the time of definition, a variable that is written by the head, without any indentation, is a global variable.Features of global variables: can be invoked anywhere in the current fileLocal variables:
Today we'll talk about two topics-global variables and non-global environments.
As we all feel at the moment, the content of global variables is very simple, but not the global context of the content of a little exercise brain ce
This article shares the differences between super global variables $ GLOBALS and global in PHP.
1. Super global variable $ GLOBALSPHP has many super global variables, and the following are all super
JS in the declaration of global variables are mainly divided into explicit declarations or implicit declarations are described below respectively.Declaration Method One:The use of the VAR (keyword) + variable name (identifier) is declared outside the function as a global variable, otherwise the function declares a local variable. The method is explicitly declared
PHP Predefined variables 9 large Super Global array usage details, global array
1, $_server
The $_server Super global variable contains information created by the Web server that provides information about the server and client configuration and the current request environment. Depending on the server, the variable va
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.