The connector--point, itself is also an operator. Its real name should be called the "character operator." The function is to connect two strings together.echo character. Variable. Characters
The dot number connects the three values to one and
function function_name () {
Global $var;
}
$var = 20;
Function_name (); Function call.
?>
Copy CodeIn this example, the $var inside the function is now the same as the $var outside the function.
For example:
CopyCodeThe Code is as follows: $ A = 1;
Include 'B. inc ';
?>
The variable $ A will take effect in the included file B. Inc. However, in user-defined functions, a local function range will be introduced. By default, any variable
Variable referencePHP reference allows you to use two variables to point to the same content The code is as follows:Copy code $ A = "ABC ";$ B = & $;Echo $ a; // output here: ABCEcho $ B; // output here: ABC$ B = "EFG ";Echo $ a; // Here, the
Example, As shown below.Using the preceding two statements, two variables are defined: the variable $ a, which contains "hello" and the variable $ hello, and the variable "world ". The following language:The output is exactly the same as that of the
For example:
The code is as follows
Copy Code
$a = 1;Include ' B.inc ';?>
Here the variable $a will take effect in the include file B.inc. However, in a user-defined function, a local function range is
The error level is set to: error_reporting (E_all | e_strict);
The array variable is not defined and will also report an error, but sometimes it really doesn't need to be reported, the PHP tutorial solution is:
@$_get[' Unkown '];
This will allow
1. Define constant define ("CONSTANT", "Hello world.");
Constants can only contain scalar data (boolean,integer,float and string).
When calling a constant, simply use the name to get the value of the constant, not the "$" symbol, such as: Echo
The definition of a variable
Type of ⚑ variable
Use of ⚑ variables
Variables are objects that exist in memory that can be constantly changed, we can think of memory as a street, there are many tenants in the street, each tenant will have their own
Each variable in PHP has a scope for it, which is an area in which you can access a variable (and thus access its value). For starters, variables are scoped to the page where they reside. Therefore, if you define a $var, the rest of the page can
A static variable exists only in a local function field, but its value is not lost when the program executes out of this scope. Take a look at the following example:
Copy Code code as follows:
function Test () {
static $a = 0;
$a + +;
echo
Copy Code code as follows:
$ (document). Ready (function () {
var t=;Alert (t)})
Or
Copy Code code as follows:
$ (document). Ready (function () {
var t= "";Alert (t)})
Or
Copy Code code as
What is the scope of a variable? The scope of a variable refers to the valid range of variables within a lifetime of a script. Generally, there are global and local points The scope of variables in PHP can be divided into: Super Global (the
Usually variables are named by the following statements:
Copy Code code as follows:
$a = ' Hello ';
?>
Variable variable name refers to the use of a variable's value as the name of the variable. In the example above, by
PHP supports the concept of variable functions. This means that if a variable name is followed by parentheses, PHP will look for a function with the same name as the value of the variable and try to execute it. Variable functions can be used to
1.1.1 Zval StructureZend uses the ZVAL structure to store the values of PHP variables, which are as follows:
Copy Code code as follows:
typedef Union _ZVALUE_VALUE {
Long lval; /* Long Value * *
Double Dval; /* Double Value * *
A static variable exists only in a local function field, but its value is not lost when the program executes out of this scope. Take a look at the following example:
Copy Code code as follows:
function Test () {
static $a = 0;
$a + +;
Today I came across a question about the memory allocation of PHP variables, recorded.
The following code:
Copy Code code as follows:
$a = Array (
' Str ' => 1,
' Child ' => 2
);
$b = $a;
$b [' child '] = $a;
$b ['
The questions about the PHP face question are as follows:
Copy Code code as follows:
$a = 1;
$x =& $a;
$b = $a + +;
?>
Ask:
What are the values of $b and $x respectively?
The answer to the PHP interview question is as follows:
$b
PHP's variable type is not many, there are the following five kinds:
StringIntegerDoubleArrayObject
Strings are string variables, either single or thousands of-character strings that use this variable type. It is worth noting that to assign a string
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.