PHP learning memo (updated)

Source: Internet
Author: User

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/

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.