PHP4 User manual: Variables-Basic _php Tutorial

Source: Internet
Author: User
7th chapter. Variable directory list Web site construction Server script Class \phpphp user manual fancylanguage.variables.html#language.variables.basics> variable variable scope variable base of variables PHP outside
Description of the variable: in PHP is a dollar specifier followed by the name of the variable. Variable names are case-sensitive.
The name of the variable is the same as the other tags in PHP. A valid variable name starts with a word line or underscore, followed by some lines, numbers, or underscores. Regarded as a regular expression, it would be this: [a-za-z_x7f-xff][a-za-z0-9_x7f-xff]*
Note: A letter is a-Z, A-Z, and ASCII characters 127 through 255 (0X7F-0XFF).
$var = "Bob"; $Var = "Joe"; echo "$var, $Var"; Output "Bob, Joe" $4site = not yet; Error The beginning cannot be a number $_4site = not yet; Effective The beginning can be underlined $täyte = Mansikka; Valid: It is ASCII 228.

In PHP 3, variables are assigned by value. In other words, when you assign an expression to a variable, the value of the original expression is copied to the destination variable.
This means that assigning the value of one variable to a different variable will only change the value of those variables without affecting the other variables. See expressions for more information.
PHP 4 provides another way to assign a value to a variable: reference assignment. This means that the new variable is simply referring to the original variable (the new variable is just a "pseudonym" or "point") and changing the new variable will affect the original variable and vice versa. This also means that no replication is performed: Therefore, the allocation is faster. However, such acceleration is only reflected in complex loops or allocations of large arrays and objects.
Assign a reference that simply assigns the variable (source variable) to the "&" number before it is added. For example, the following code snippet outputs my name is Bob two times:

An important hint: only one of the specified variables can be assigned by reference.

http://www.bkjia.com/PHPjc/532351.html www.bkjia.com true http://www.bkjia.com/PHPjc/532351.html techarticle 7th chapter. Variable directory list Web site construction Server script Class \phpphp user manual fancylanguage.variables.html#language.variables.basics> variables of the underlying fixed variable variable scope variable ...

  • 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.