Home >Backend Development >PHP Tutorial >PHP interview questions set_PHP tutorial
Interview question 1
1. Use PHP to print out the time of the previous day in the format of 2006-5-10 22:21:21
2. The difference between echo(), print() and print_r()
3. A template that enables HTML and PHP to be used separately
4. How to realize PHP and JSP interaction?
5. What tools are used for version control?
6. How to implement string flipping?
7. Methods to optimize MYSQL database.
8. Talk about transaction processing
9. The method of apache+mysql+php to achieve maximum load
10. The method of intercepting Chinese text strings without garbled characters.
Interview question 2
var $empty = '';
var $null = NULL;
var $bool = FALSE;
var $notSet;
var $array = array();
1.
$a = "hello";
$b = &$a;
unset($b);
$b = "world";
what is $a?
2.
$a = 1;
$x = &$a;
$b = $a++;
what is $b?
3.
$x = empty($array);
what is $x? true or false
4. Have you used version Control software? If so, what is the name of the version control software you use?
5. Have you ever used a template engine? If so, have you used it? What is the name of the template engine?
6. Please briefly describe your most proud development work.
7. For everyone For a website with high traffic, what method do you use to solve the traffic problem?
8. Use PHP to write the code to display the client IP and server IP:
Interview Question 3
1. PHP/MySQL Programming
1) In a content management system, the message table has the following fields
id article id
title Article title
content Article content
category_id Article category id
hits Clicks
Create the above table and write the MySQL statement
2) Same as the above content management system: table comment records user reply content, the fields are as follows
comment_id reply id
id article id, associated with the id in the message table
comment_content reply content
Now you need to get the article title in the following format by querying the database List, and sorted by the number of replies, with the highest reply at the top
Article id Article title Clicks Number of replies
Use a SQL statement to complete the above query, if If there is no reply to the article, the number of replies will be displayed as 0
3) In the above content management system, the table category saves classification information, and the fields are as follows
category_id int(4) not null auto_increment;
categroy_name varchar(40) not null;
When the user enters an article, select the article category by selecting the drop-down menu
Write how to implement this drop-down menu
2. PHP file operation
1)
The above content management system: after the user submits the content, the system generates a static HTML page; write down the basic idea of implementation
2) Briefly describe the user modification Based on the implementation process and basic ideas of publishing content
3. PHP program
1) Write the output results of the following program
$ b=201;
$c=40;
$a=$b>$c?4:5;
echo $a; ?>
2) Write the output result of the following program
$str="cd"; $str="hotdog";
$$str.="ok";
echo $cd;
?> Interview Question 4
1. Short answer questions
1. Please explain the difference between passing values and passing references in PHP. When to pass by value and when to pass by reference?
2. What is the function of error_reporting in PHP?
3. Please write a function to verify whether the format of the email is correct.
4. Briefly describe how to get the current execution script path, including the obtained parameters.
Note: For example, there is a script www.domain.com, and the parameters passed to it are parameter 1, parameter 2, parameter 3...
The method of passing parameters may be GET or POST, so please now Write a result similar to
http://www.domain.com/script.php? Parameter 1=value 1¶meter 2=value 2....
5. How to modify the survival time of SESSION.
6..There is a web page address http://www.domain.com/xxx.php, how to get its content?
7. There is a one-dimensional array that stores integer data. Please write a function to arrange them in order from large to small. High execution efficiency is required. and explain how to improve execution efficiency. (This function must be implemented by yourself, you cannot use PHP functions)
8. Please give an example of what method you use to speed up page loading during your development process.
2. Database design questions:
Please design a database table structure for a library book borrowing management system; it can record basic user information, book information, borrowing and returning book information; the structure of the data table The number should not exceed 6; please draw a table to describe the table structure (the field name, field type, and field meaning description of each field need to be explained);
In database design, the following should be:
1. Guarantee the uniqueness of each user;
2. Ensure the uniqueness of each book; each book corresponds to multiple books with different numbers; ensure the uniqueness of each book;
3. In the book borrowing information table, both borrowing and returning behaviors should be considered, as well as the borrowing period;
4. Ensure the referential integrity between the borrowing information table, the user table, and the book information table;
5. Limit the maximum number of books each user can borrow
6. If a new user registers or a new book is added to the library, its unique identifier is guaranteed to be automatically generated
7. Provide support for the following series of report requirements:
(No specific instructions, no need to write implementation statements, but need to ensure that these reports can be implemented with at most one SQL statement in the database design)
a) Daily statistical report : Report on the number of books borrowed on the day and the number of books returned on the day;
b) Real-time report:
i. The current number of borrowed books and the number of books that can be borrowed;
ii. All overdue books in the current system, List of users and their overdue days
iii. The number of books borrowed by all users in the current system is listed by user (including users who have not borrowed books); please write the SQL statement to achieve this requirement:
Database application:
Please write a series of SQL statements to describe the complete borrowing and returning books respectively; and ensure the execution integrity of this series of SQL statements
The next question is the most important test of ability If the test cannot be completed, we will not be able to give a judgment result! So please write a detailed answer and ensure that the answer is an executable program. Send the results via email to hr@88keke.com within two days
Combined with your design in the second question, use a database to implement it. It is required to use a three-tier structure or a multi-tier structure, and it is required to adopt an oriented Program with the idea of objects, and if possible, design a template mechanism to implement it.
Function: List the current borrowed books, sorted by date
Number User name Title of book Number of book Borrowed date
1. Zhang Jin Dayanfang 12576587 2004-9 -1
2. Liu Xing Journey to the West 32131098 2004-9-2
......
Interview Question 5
1. In PHP, the name of the current script (not included path and query string) are recorded in the predefined variable (1); and the URL linking to the current page is recorded in the predefined variable (2).
2. Execute the program segment will output (3).
3. In HTTP 1.0, the meaning of status code 401 is (4); if a "File not found" prompt is returned, the header function can be used, and its statement is (5).
4. The function of array function arsort is (6); the function of statement error_reporting(2047) is (7).
5. The database connection string format in PEAR is (8).
6. Write a regular expression to filter all JS/VBS scripts on the web page (that is, remove the script tag and its content): (9).
7. Install PHP as an Apache module. In the file http.conf, first use statement (10) to dynamically load the PHP module, and then use statement (11) to make Apache install all extensions with php Files are processed as PHP scripts.
8. The statements include and require can include another file into the current file. The difference between them is (12); in order to avoid including the same file multiple times, you can use the statement (13) replace them.
9. The attributes of the class can be serialized and saved to the session, so that the entire class can be restored later. The function to be used is (14).
10. The parameter of a function cannot be a reference to a variable, unless (15) is set to on in php.ini.
11. The meaning of LEFT JOIN in SQL is (16 ). If tbl_user records the student's name (name) and student number (ID), tbl_score records the student's (some students were expelled after the exam and there is no record of them) student number (ID) and test scores (score) as well as test subjects (subject), if you want to print out the name of each student and the corresponding total score of each subject, you can use SQL statement (17).
12. In PHP, heredoc is a special string, and its end flag must be (18).
13. Write a function that can traverse all files and subfolders in a folder.
14. Briefly describe the implementation principle of infinite classification in the forum.
15. Design a web page so that when it is opened, a full-screen window pops up with a text box and a button in the window. After the user enters information in the text box and clicks the button, the window can be closed, while the entered information is displayed on the main web page.
Interview Question 6
There is a table menu (mainmenu, submenu, url). Please use recursion to write a tree menu and list all menus.
Interview Question 7
1- Given three numbers, write a program to find their maximum value.
2- Talk about the advantages and disadvantages of asp, php, jsp
3- Talk about the understanding of mvc
4- Write the SQL of the names of the ten people with the most posts, using the following table:
members(id, username, posts, pass, email)
Interview question 8
1-How to determine whether a window has been blocked through javascript.
2-Write the operating mechanism of session
3-There is an array $a=array(4,3,8,9,2); please reorder it and list it in order from small to large.
4-To prevent SQL injection vulnerabilities, the _____ function is generally used.
5-Query the number of people online and handle abnormal disconnection SQL