The first time to write a blog is very tense, sure enough to work when the brain more clear-minded. I am just a rookie, and there is no outline, presumably belongs to the scope of entertainment, light spray.
Well, the first blog post on the water reference and the value is good, this everyone knows ah, there is nothing good water, I don't care I don't care, I will send.
First two examples
<? php $a = array ( (' id ' = = 1, ' name ' = ' Zhangsan '), array (' id ' = = 2, ' name ' =&G T ' Lisi '), array (' id ' = = 3, ' name ' = ' Wanwu ' $v [' id ' $v [' name ']. " SSSs "; print_r ( $a );
<? PHP $a = ' Hello '; $b = &$a; $b = "word"; Echo $a,$b;
Well, good side, just went to Baidu a bit, sure enough to find a lot. (Pretend you didn't see it).
These two examples can see that the value of $ A is changed, because $ A actually points to the address of the variable, and then $b, $v, is assigned to the same address, so when $b, $v change the time $ A changed.
It is worth mentioning that the variable name of the array in C is pointed to the first variable of the array, do not know PHP is not, but PHP does not have the concept of pointers, bad test, I found that the concept of PHP memory is so vague. Baidu a bit found SHMOP can operate memory, back to the virtual machine to try.
And the memory of the PHP storage variables is actually pre-allocated, leaving a bit empty. Memory_get_usage () can view PHP memory consumption balabala. It's easy to test it out. For example, I was testing $a= "s" and $a= "Sssssss" when PHP consumes the same amount of memory, but $a= ' Sssssssa ' more than one character is occupied by the memory will suddenly more than 16 bytes.
About this I have seen in the design and implementation of Redis introduction
That's it, let's do it, read more books, the next chapter is interesting.
PHP notes One