PHP interview pit


Because of the need for an interview recently, I specially sorted out some interview questions. Share it. I hope it will be useful to yourself and others. If there is no answer, it will be updated one after another. If there is a supplementary answer, I would like to thank you very much.

1. The difference between get and post

**The display is different**

2. Require, include difference

Require is unconditional inclusion, that is, if require is added to a process, require will be executed first regardless of whether the condition is true or not

3. Get the URL suffix

Pathinfo() parses the file path and returns its components;

4. Differences between TCP, UDP and http

Reference link: 31332467/article/details/79217262

5. How to get the superior directory

echo __ FILE__  ; / / get the absolute path and address of the current file. The result is: D: AAA\ my.php

6. Master slave replication, read-write separation

*What is master slave replication

7. Database index

**What is an index**

8. High concurrency solution

Web server Optimization: load balancing

9. Understanding of MVC

1. Model (business model): the part of an application that processes the data logic of the application. Usually, the model object is responsible for accessing the data in the database.           

10. Common file operation functions

**1. Get the file name:**

11. Common sorting algorithms

1. Bubble sorting

12. The difference between interface and abstract class

1. Interface

13. The difference between InnoDB and MyISAM


14. Common design patterns

#Strategy model

15. Write the multiplication table algorithm


16.echo,print_ r ,print,var_ Dump difference

Echo is a PHP statement, print and print_ R is a function, the statement has no return value, and the function can have a return value (even if it is useless)

17. The difference between session and cookie

Session: stores the globally unique variables accessed by users, stored in the directory specified by PHP on the server_ DIR)

18. Write the code of displaying client IP and server IP with PHP


19. What security should SQL statements consider

(1) Prevent SQL injection, escape special characters, filter or bind with precompiled SQL statements

20. The method of optimizing myski database

(1) Select the appropriate field and set the field to not null, so the database does not need to compare null when querying;

21. For websites with large traffic, what methods will you adopt to solve the traffic?

(1) First, confirm whether the server hardware can support the current traffic;

22. The difference between isset(), empty()


23. Six design principles (connected with 14 design modes)

1. Single responsibility principle: a class is responsible for only one responsibility.

24. Difference between group by and distinct

25. What security mechanisms should be paid attention to in development

1. PHP configuration

26. Differences between Memcache and redis

Data structure: Memcache only supports simple key value form, and redis supports more data (string string, set set set, list list, hash hash, Zset ordered set);

27. Common array functions

Key names and arrays:

28. The principle of browser access through URL

1. Enter the URL on the keyboard or touch screen and press enter to confirm

29. Common load balancing schemes

1. Load balancing based on DNS

30.mysql_ fetch_ Row() and MySQL_ fetch_ The difference between array () and

mysql_ fetch_ Row() takes a row of data from the result set associated with the result ID data and returns it as an array. The columns of each result are stored in the cells of an array, with offsets starting from 0. Call MySQL in turn_ fetch_ Row () returns the next row in the result set, or false if there are no more rows.

31. How to ensure that the code can run normally in multiple PHP versions

By modifying the fastcgi of nginx configuration file, listen to different ports and select different versions.

32. Analyze the reasons for slow query of MySQL

1. View slow query log

33. How to exchange the values of two variables without the aid of a third variable

String exchange:

34. The difference between char and varchar

1. Varchar is used to store variable length and char is used to store fixed length

35. Four features of MySQL transaction

Generally speaking, a transaction must satisfy four conditions (acid): atomicity, consistency, isolation, and durability.

36. Threads and processes

Process: it is the basic unit of allocating and managing resources during the execution of concurrent programs. It is a dynamic concept and the basic unit of competing computer system resources.

38. HTTP status code


39. Troubleshooting method of Linux server CPU load is too high

Reference link:

40. Common search algorithms

Reference link:

41. When the Boolean value is false in PHP


42. Three ways to realize redirection in PHP

1. Header() function;

This work adoptsCC agreementThe author and the link to this article must be indicated in the reprint

Recommended Today

Rust programming video tutorial (Advanced) – 024_ 3 syntax of all modes 3

Video address Headline address:…Station B address: Source address GitHub address:… Explanation content 1. Ignore values in mode(1) Use_ Ignore entire valueexample: fn foo(_: i32, y: i32) { println!(“This code only uses the y parameter: {}”, y); } fn main() { foo(3, 4); } Note: placeholders are used for parameters in the function, mainly when implementing […]