: This article mainly introduces the php learning code note. if you are interested in the PHP Tutorial, you can refer to it. 16/2/22
Value assignment
1 $ a = "cmflovehxc"; 2 $ B = $ a; 3 $ c = & $ a; 4 $ a = "cmflovehxc"; 56 echo $ B ."
"; 7 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 echoconstant ($ p ); // 3.14 5if (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.
The above introduces the php learning code note, including some content, and hopes to help those who are interested in the PHP Tutorial.