Home >Backend Development >PHP Tutorial >2019 Latest PHP Mock Interview Questions and Answers
Every time we reach the final critical stage, we will continue to conduct mock interviews. PHP Chinese Network allows some students to successfully complete their studies and find their ideal jobs. Here, PHP Chinese Network shares some PHP interview questions mentioned in PHP mock interviews for your reference, study and communication. [Recommended tutorial: php programming introductory tutorial]
Related recommendations: "2019 PHP interview questions summary (collection)"
PHP simulation The interview questions are summarized as follows:
1. How to prevent repeated submission of form forms?
2. Can the session still be used if cookies are disabled?
3. What version control tools do you know or have used? Just explain it briefly.
CVS,SVN, vss, git
4. How to realize the advantages of singleton mode?
5. What is the difference between single quotes and double quotes?
(1) Double quotes can parse variables, but single quotes cannot parse variables
(2) Double quotes and single quotes can be nested in each other
(3) Variables in double quotes can be separated by special characters, but the special characters will be output as they are. Using {} will not output
(4) Double quotes contain single quotes, and single quotes contain variables, and the variables will be is parsed, single quotes will be output as they are
(5) Double quotes can parse escape characters, single quotes will not parse escape characters, single quotes will only parse the escape of \ itself and '
(6) Single quotes are nested within single quotes, and double quotes are nested within double quotes. The single quotes and double quotes need to be escaped using \ to comply with
(7) Single quote efficiency higher than double quotation marks
6. For websites with large traffic, what method do you use to solve the traffic problem?
7. What is the main difference between the field types varchar and char in the MySQL database? Which field has higher search efficiency? Why?
8. Explain the differences between echo(), var_dump(), and print_r().
9. Please explain the difference between passing by value and passing by reference in PHP. When to pass by value and when to pass by reference?
10. Explain the difference between Include, include_once, require, and require_once?
11. Methods to optimize MYSQL database. (4 points, the more you write, the more you get)
Answer: (1) Select the most applicable field attributes, reduce the length of the defined fields as much as possible, and try to set the fields to NOT NULL, such as 'province, gender' , it is best to set it to ENUM.
(2) Use join (JOIN) instead of subquery:
(3) Use union (UNION) instead of manually created temporary table
(4) Transaction Processing:
(5) Lock the table, optimize transaction processing:
(6) Use foreign keys, optimize the lock table
(7) Create index:
(8) Optimize query statements
12. How to optimize query statements and improve query efficiency?
13. What is the difference between Session and cookie?
14. What is the difference between Get and post?
15. What is a mysql transaction? What are the characteristics of transactions?
16. Commonly used super global variables
$_GET ----->get transmission method
$POST -- --->Post transmission method
$REQUEST ----->Can receive values in both get and post methods
17.HTTP status code
200 - Request successful
301 - The resource (webpage, etc.) is permanently escaped to another URL
404 - The requested resource (webpage, etc.) does not exist
505 - Internal Server Error
1** - Information, the server received a request that requires the requester to continue performing the operation
2** - Success, the operation was successfully received and Handling
3** - Redirect, further action is required to complete the request
4** - Client error, the request contains a syntax error or the request cannot be completed
5 ** Server error. An error occurred while the server was processing the request.
18. How to get the client’s IP (requires an int) and the code of the server’s IP
Client: $_SERVER["REMOTE_ADDR"]; or getenv ('REMOTE_ADDR')
Server: gethostbyname ('www.baidu.com')
19. Write Names of more than three MySQL database storage engines
MyISAM, InnoDB, BDB (BerkeleyDB), Merge, Memory (Heap), Example, Federated,
Archive, CSV, Blackhole , MaxDB and more than a dozen engines
20. Have you ever used Memcache cache? If so, can you briefly describe its working principle
Memcahce is All data is stored in memory in the form of a hash table. Each piece of data is composed of key and value. Each key is unique. When accessing a certain value, first find the value and then return the result.
Memcahce uses the LRU algorithm to gradually clear out expired data
21. Explain what the Ajax implementation principle is and what role json plays in Ajax
The working principle of Ajax is that the specified location of one page can load all the output content of another page. In this way, a static page can also obtain the returned data information from the database. Therefore, Ajax technology enables a static web page to communicate with the server without refreshing the entire page, reducing user waiting time, thereby reducing network traffic and enhancing the friendliness of the customer experience.
When using Ajax, it involves data transmission, that is, returning data from the server to the client. The server and client use different script languages to process data, which requires a common data format. XML and json are the two most commonly used, and json is simpler than XML
22.php lists 3-6 string processing functions
strlen() The function returns the length of the string
strpos() The function is used to retrieve the specified characters or text within the string
strtolower — Convert the string to lowercase
strtoupper – Convert the string to lowercase Convert the string to uppercase
strtr — Compare and replace the string
substr — Intercept the string
explode — Convert a string into an array using a delimiter Form
implode — Convert an array into a string using a specific delimiter
To sum up, these are the PHP simulation interview questions shared by the php Chinese website for your reference and learning. Practice, use it flexibly, and successfully pass the real interview. Finally, I wish you all can find a satisfactory job in the future.
The above is the detailed content of 2019 Latest PHP Mock Interview Questions and Answers. For more information, please follow other related articles on the PHP Chinese website!