Php learning code and php code. Php learning code note: php code note 16222 string connection (1) connection operator (.): it returns the string obtained after attaching the right parameter to the left parameter. (2) connection assignment operations php learning code note, php code note
16/2/22
String connection
(1) concatenation operator ("."): it returns the string obtained after attaching the right parameter to the left parameter.
(2) join value assignment operator (". ="): It attaches the parameter on the right to the parameter on the left.
It is equivalent to ++ = in JS.
$ B = "East Sunrise West rain"; $ B. = ", the road is not clear but there is clear"; $ c = "East Sunrise West rain"; $ c = $ c. ", the road is not clear but clear"; echo $ B."
"; // East Sunrise West rain, road is no clear but clear echo $ c ."
"; // East Sunrise West rain, road is no clear but clear
Value assignment
$ A = "cmflovehxc ";
$ B = $;
$ C = & $;
$ A = "hxclovecmf ";
Echo $ B ."
";
Echo $ c;
(1) "=": assigns the value of the right expression to the number of operations on the left. It copies the expression value on the right to the number of operations on the left. In other words, I first applied a piece of memory for the number of operations on the left, and then put the copied value in the memory.
It is equivalent to the equal sign of JS. Variable assignment; two variables are two different heap memory.
(2) "= &": reference value assignment, meaning that both variables point to the same data. It will make the two variables share a piece of memory. if the data stored in this memory changes, the values of the two variables will change.
The two variables are two identical heap memory.
Constant
1 define ("PI1", 3.14); 2 $ p = "PI1"; 3 echo $ p; // PI1 4 echo constant ($ p ); // 3.14 5 if (defined ($ p) = true) {6 echo '000000'; 7} else {8 echo '000000'; 9} 10 // 111 is returned
11 // both constant () and defined () have a translation function.
Concatenation operator (.): returns the string obtained after attaching the right parameter to the left parameter. (2) join value assignment...