I will not re-write a blog for many of the content I have written, but I certainly do not understand it deeply. Only used as a memo.
1. PHP reference
PHP references and misunderstandings
Http://weizhifeng.net/php-reference.html
However, after discussing it with a friend, he mentioned that it is not appropriate to compare the pointer used with C ++. Pointers can be computed, but references similar to C # Are Not computed like ++. The ultimate definition of a pointer is to model the memory of a linear address space. Only C ++/C can directly access the physical memory in this way. So it is more appropriate to compare the PHP reference with the C # reference?
2. Equal sign
Http://stackoverflow.com/questions/4732706/whats-the-difference-between-equal-and-identical-comparison-operators-in-php
1 = "1" will return true, because the type is forced to convert automatically. This is similar to JavaScript.
3. Array
PHP array is similar to Dictionary in C #. The key can be a continuous number, a non-continuous number, or a string.
The initial value assignment can be as follows:
$ Arr = array (); $ arr [0] = 1;
To traverse, you can:
Foreach ($ arr as $ key =>$ value) {echo $ key. "-". $ value ;}
4. Create a web service
To create a web service that supports both XML and JSON, see:
Http://davidwalsh.name/web-service-php-mysql-xml-json
In fact, echo generates an XML file.
To output only JSON data directly, see:
Http://jakesankey.com/blog/2012/09/php-simple-rest-server/