The value types of PHP and C # are different. The copy difference between PH and C # values (if not, I hope to point it out !) $ A2; $ B $ a; in php, point B's address to a, so B is equal to 2 at this time. The difference lies in $ a5; at this time, the copy of p PH and C # values is different (if anything is wrong, I hope to point it out !)
$ A = 2;
$ B = $ a; // In php, point B's address to a, so B is equal to 2 at this time. The difference lies in this
$ A = 5; // at this time, php re-writes the value of a, so the php core will re-allocate B to an address, and then copy the original value of. This is the principle of copy during write. that is to say, unless a write operation is performed, the value type points to an address.
C. Value type replication. Always create an address, for example:
Int a = 2;
Int B = a; // whether or not the secondary write of a is performed .. NET will allocate a new memory space to B (the value exists in the stack space ). Then copy the value of.
Note: values of the value type in C # are directly stored in the stack. For the reference type, the reference address is stored in the stack, and the actual value is stored in the heap. Locate the value in the stack based on the stack address.
Else (if something is wrong, I hope to point it out !) $ A = 2; $ B = $ a; // In php, point the address of B to a, so B is equal to 2. The difference is that $ a = 5; // p...