Interview Questions---PHP

Source: Internet
Author: User

1, PHP (foreign name: Hypertext Preprocessor, Chinese name: "Hypertext Preprocessor") is a common open source scripting language.

2. The difference between Echo,print and Print_r:

Both Echo and print can be output, except that echo is not a function, there is no return value, and print is a function with a return value, so relative to the output echo is faster, and print_r is often used to print information about variables, usually in debugging.
Print is a printed string
Print_r is the print composite type Array Object
3. The difference between require and include:
Require a file in error, then the program will be interrupted execution, and display a fatal error;
Include a file if there is an error, then the program will not be the middle end, but continue to execute, and display a warning error;
4
. The difference between Sort,asort and Ksort:

Sort based only on values from small to large, key values do not participate in sorting

Asort Sort by value, key value participates in sort

Ksort sorted by key value, value participates in sort

5. the difference between a session and a cookie:

  The cookie data is stored on the client's browser and the session data is placed on the server;

Cookies are not very secure, and others can analyze cookies stored locally and make cookie spoofing
Consider that the session should be used for safety;

The session will be saved on the server for a certain amount of time. When access is increased, it will be more likely to occupy your server's performance
In view of mitigating server performance, cookies should be used;

A single cookie cannot hold more than 4K of data, and many browsers limit a maximum of 20 cookies per site;

Recommendation: The login information and other important information stored as a session, other information if necessary to retain, can be placed in a cookie.

6, the meaning of the @ symbol:
@ Represents the statement after the @ symbol if there is an error will be ignored, will not prompt, because PHP runtime will be some errors, some reminders of the error, if you use @ then this statement has errors will not be prompted
7, the common status code
  200– server successfully returned to Web page
  404– The requested page does not exist
  503– Server is temporarily unavailable
500– Server Internal Error
    •    401 -Not authorized
8, memcache working principle of the hash table
Memcache's job is to maintain a huge hash table in the memory of a dedicated machine to store some of the arrays and files that are often read and written, thus greatly improving the efficiency of the website.
9. The difference between XHTML and HTML
XHTML is HTML like XML, a transitional language, it is higher than the rigor of HTML, and then the basic language is still the use of HTML tags, but the abolition of some of the performance layer of the label, colleagues in the standard requirements of high points such as the strict nesting of tags, label end and so on
10. Destructors and Constructors:
__construct () is called when an object is created, and __destruct is called when the object is destroyed.
11. How to optimize MySQL database:
Create indexes, composite indexes, indexes that do not contain columns with null values, use short indexes, sorted index problems, like statement actions, do not operate on columns, do not use not in and < > Operations, optimize your MySQL query cache, get unique rows with limit 1, use explain to make your select query clearer,   Ensure that the index of the connection is the same type , do not use the by RAND () command,   try to avoid the SELECT * command, get recommendations from procedure analyse () , store the IP address as an unsigned integer, uses a connection (join) instead of a subquery.
12, char, varchar, and nvarchar differences
  char is fixed length;
nvarchar (n): variable-length Unicode character data with n characters;
varchar:
strong> variable-length, non-Unicode character data with a length of n bytes.
13, the three normal forms of the table:
The first paradigm (1NF) requires that the information be atomic, and that the information is not re-divided.
The second paradigm (2NF) requires that the data conform to the criteria of the first paradigm, and the data elements are organized into groups, eliminating redundant data. Each group contains a primary key and non-critical data, and non-critical data must be functionally dependent on the primary key.
The third paradigm (3NF) requires that data elements conform to the criteria of the second paradigm, while non-critical data cannot contain dependencies.

Interview Questions---PHP

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.