This article mainly introduces the definition of PHP variables, variable variables, variable references, destruction methods, the need for friends can refer to the following
Code as follows: <?php $long = "Big_long_variable_name"; $ $long = "PHP"; /* Use the string stored in the variable $long as the variable name for the new variable, equivalent to $big_long_variable_name= "PHP"; * * $short =& $big _long_variable_name; /* takes the value of the variable $big_long_variable_name to the variable $short, at which point the $short value is "PHP", equivalent to $short=& $ $long; */print "01/$short is $short."; /* "/$" is an escape sequence that represents the output of a dollar sign $, hereinafter. The function of this statement is output: $short is PHP. */print "Long is $big _long_variable_name."; /* Output: A Long is PHP. * *?> <br/> <br/> <?php $big _long_variable_name.= "rocks!"; /* Re-assign values to $big_long_variable_name. During the $big_long_variable_name, the value of the variable $big_long_variable_name at this point should be the original value ("PHP") + The New value ("rocks!") as a result of the addition of the. (point number). , that is, the variable $big_long_variable_name the current complete value is "PHP rocks!". Same */print "03/$short is $short"; /* Output: $short is PHP rocks! */print "Long is $big _long_variable_name"; /* Output: Long is PHP rocks! *?> <br/> <br/> $short is PHP rocks! The Long is PHP rocks! <br/> <br/> <?php $short. = "Programming $short"; &nbSp /* Re-assign the variable $short. Because you added a. (point number) after $short, refer to the above example to analyze the value of $short. */print "07/$short is $short"; /* Output: Modified $short is PHP rocks! Programming PHP rocks! */print "Long is $big _long_variable_name"; /* Because the variable $short is assigned to programming PHP rocks!, the value of the variable $big_long_variable_name is also changed to "PHP $short" with rocks! Programming PHP rocks! ". Output of this statement: Long is PHP rocks! Programming PHP rocks! Note that if a variable with the same value is destroyed unset (), the other variable does not apply to this case and is not destroyed together. *?> <br/> <br/> $short is programming PHP rocks! A Long is programming PHP rocks! <br/> <br/> <?php $big _long_variable_name.= "Web programming $short"; The /* variable $big_long_variable_name is assigned a value, at which point its full value should be PHP rocks! Programming PHP rocks! Web Programming PHP rocks! Programming PHP rocks!. Variable $short on this time and variable $big_long_variable_name consistent. Please refer to the 5th and 10th notes for analysis respectively. */print "11/$short is $short"; /* output: one PHP rocks! Programming PHP rocks! Web Programming PHP rocks! Programming PHP rocks! */print "Long is $big _long_variable_name";?> <bR/> <br/> <?php unset ($big _long_variable_name); /* Destroy variable $big_long_variable_name with unset (), variable $short will not be affected by any of them. */print "13/$short is $short"; /* Although the variable $big_long_variable_name was destroyed, the $short was not affected and its value is still the last given PHP rocks! Programming PHP rocks! Web Programming PHP rocks! Programming PHP rocks! */print "Long is $big _long_variable_name."; /* Variable $big_long_variable_name has been destroyed and therefore has no value. Output:. * * SNOW; &NB Sp.?> <br/> <br/> <?php $short = "No point TEST1"; * Re-assign the variable $short. Since it was not added after $short this time, the $short current value is "no point TEST1". */print "15/$short is $short."; /* Output: $short is No point TEST1. * * $short = "No point TEST2 $short"; * Re-assign the variable $short. did not add a. (dot) after $short, but referred to its own last value "no point TEST1". */print "16/$short is $short."; /* Output: $short is no. TEST2 no point TEST1. * *