PHP study Notes-php variable-PHP Tutorial

Source: Internet
Author: User
PHP learning notes-related variables in php. Variable variables in PHP (For more information, see The php Manual): Variable variables in php are interpreted as a variable name, read the value of the variable name. Example: Variable variables in PHP (For more information, see The php Manual ):

To put it bluntly, the variable in php parses the value of a variable into a variable name and reads the value of that variable name. Instance:

  

 ";       $."
"; = "f"; $."
"; = "b"; $."

"; ."
"; $."
"; $$."

"; ."
"; $."
"; $$."
"; $$$."

"; = "China"; ."
"; $; ?>

Note: Variable variables cannot be applied to $ this and Super global variables (the scope of php variables is different from that of other advanced programming languages. View code)

 ";      ;          "
" ; ."
"; "; ['name']; ?>

Variable functions:

 

A typical application of variable variables:

 Untitled Document        

$ = ."
"."
"."
"?>

  Supplement:

Variable features. If a variable is not declared in advance, if you want to assign a value to a variable, a PHP operation in the background is that when you assign a value to this undeclared variable, the background has already affirmed this variable for you. Let's look at the example:

 Name )? "True": "false"). "--"-> = A ();-> show ();-> name = "I have output. This variable is declared! ""
"-> Show ();?>

Summary: After reading the above example, you will see the code encapsulated by others. if there is a variable that is not declared, it will be used directly. Don't be surprised. You must set it yourself. You just need to assign values... (PS: In fact, I am also confused at the beginning, because I used to engage in. NET in C #, it is absolutely not allowed to happen. Strong languages are used... Looking at this weak type of language, it is not very suitable at the beginning)

Callback (For more information, refer to the php Manual): the variable name in php is interpreted as a variable name to read the value of the variable name. Instance :...

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.