variable variable: That means a variable Variable gets a the value of the normal variable as this Variable name of variable variable . For example:
<?Php
Header"Content-type:text/html;charset=utf-8");
$uername=' There's a girl in the village ';
$name=' Xiaofang ';
$xiaofang=' The girl of Osaka Castle ';
//$$name =$xiaofangEcho$ $name;
//Use of variable variables
$banzhuren=' Xucaihui ';
$xucaihui=' man ';
$man=' lvyou ';
$lvyou=' Taiguo ';
$taiguo=' It's a woman '.;
Echo$ $ $banzhuren;
Output: The girl from Osaka Castle is a woman.
A reference to a variable is assigned a value:
The reference operator & can be used in associative assignments, just like an alias, so that the variable points to the same address in memory.
(Headphones example: Only one song, left and right can be heard, one of them broken, another heard the same song
MP3 in the original there are 2 songs, after the variable reference assignment, will be one of the deleted, the appearance of two buttons, one is a small Apple song, the other is a small orange song, the small orange deleted, two buttons can only choose a song, the output is the same)
<?Php
$user=' Canglaoshi ';
$name= ' Wulaoshi ';
//Causes the value of the $name to point to $user, and discards the value of $name
$name=&$user;
Echo$name;
Echo' <br/> ';
Echo$user;
//Determine if the result is the same, the result is a 10-byte string
if(Empty($name)) {
Echo' Kong ';
}Else{
Echo' Feikong ';
};
Echo' <br/> ';
Var_dump ($user);
Echo' <br/> ';
Var_dump ($name);
Echo' <br/> ';
//Destroy variable $user, $name output is still canglaoshi, enough to prove that only one value is left in memory
unset($user);
Echo' <br/> ';
Echo$name;
Echo$user;
Output Result:
Canglaoshi
Canglaoshifeikong
StringTen)"Canglaoshi"
StringTen)"Canglaoshi"
Canglaoshi
Notice:Undefined variable:User in D:\xampp\htdocs\ the\exercise\ the-7- -PHP kongzhiyuju\01yinyon. PHP on line in
This article is from the PHP Learning notes blog, so be sure to keep this source http://phpst.blog.51cto.com/6922579/1557171
PHP mutable variables