PHP interview questions

Source: Internet
Author: User

Interview question 1
1. Use PHP to print the time format of the previous day in the format of 22:21:21
2. Differences between echo (), print (), and print_r ()
3. templates that can be used to split HTML and PHP
4. How to Implement PHP and JSP interaction?
5. What tools are used for version control?
6. How to Implement string flip?
7. Optimize the MYSQL database.
8. Talk about Transaction Processing
9. How to achieve maximum load using apache + mysql + php
10. The method for intercepting Chinese strings without garbled characters is implemented.

Interview question 2
Var $ empty = '';
Var $ null = NULL;
Var $ bool = FALSE;
Var $ notSet;
Var $ array = array ();
1.
$ A = "hello ";
$ B = & $;
Unset ($ B );
$ B = "world ";
What is $?

2.
$ A = 1;
$ X = & $;
$ B = $ a ++;
What is $ B?

3.
$ X = empty ($ array );
What is $ x? True or false

4. Have you used version control software? What is the name of the version control software you use?

5. Have you used the template engine? What is the name of the template engine that you use?

6. Briefly describe your most proud development work.

7. What methods do you use to solve the traffic issue for websites with large traffic volumes?

8. Use PHP to write the code that shows the Client IP address and Server IP Address:

Interview question 3
I. PHP/MySQL Programming

1) In a content management system, the table message has the following fields:
Id Article id
Title article title
Content
Category_id document category id
Hits clicks

Create the table above and write MySQL statements

2) Similarly, the preceding Content Management System: The table comment records the user's reply content. The fields are as follows:
Comment_id reply id
Id Document id, associated with the id in the message table
Comment_content reply content

To query the database, you need to obtain a list of article titles in the following format and sort them by the number of replies.

Article id: number of replies in the document title

Use an SQL statement to complete the above query. If the article does not reply, the number of replies is displayed as 0.

3) in the preceding content management system, the table category stores the category information. The fields are as follows:

Category_id int (4) not null auto_increment;
Categroy_name varchar (40) not null;

When you enter an article, select an article category from the drop-down menu.

Write down how to implement this drop-down menu

Ii. php file operations

1)
The above content management system: After the user submits the content, the system generates a static HTML page and writes out the basic ideas for implementation.

2) briefly describe the implementation process and basic ideas of user modification to publish content

3. PHP Program

1) write the output results of the following program
<?

$ B = 201;

$ C = 40;

$ A = $ B> $ c? 4: 5;

Echo $;

?>

2) write the output results of the following program

<?

$ Str = "cd ";

$ Str = "hotdog ";

$ Str. = "OK ";

Echo $ cd;

?>

Interview question 4
I. Short answer
1. The difference between passing a value in php and transferring a reference. When will the value be passed for reference?
2. What is the role of error_reporting in PHP?
3. Write a function to verify that the email format is correct.
4. Briefly describe how to obtain the path of the script to be executed, including the obtained parameters.
Note: for example, there is a script www.domain.com, and the parameters passed to it include parameter 1, parameter 2, parameter 3 ....
The method for passing parameters may be GET or POST, so please write a similar
Http://www.domain.com/script.php? Result of parameter 1 = value 1 & Parameter 2 = value 2...
5. How to modify the SESSION survival time.
6. There is a webpage address http://www.domain.com/xxx.php. How can this problem be solved?
7. There is a one-dimensional array that stores integer data. Please write a function to sort them in ascending order. High execution efficiency is required. It also describes how to improve execution efficiency. (This function must be implemented by yourself and cannot use php functions)
8. Examples are provided to illustrate how to accelerate page loading during your development process.

Ii. Database Design Questions:
Please design a database table structure for the library Borrowing Management System; you can record basic user information, book information, and borrow and return information; the number of data tables cannot exceed 6; please draw a table to describe the table structure (you need to describe the field name, field type, and field description of each field );

In the database design, you should:
1. Ensure the uniqueness of each user;
2. Ensure the uniqueness of each book; each book corresponds to multiple books of different numbers; Ensure the uniqueness of each book;
3. In the borrowing information table, both borrowing and returning behaviors should be taken into account, and the borrowing period should be considered;
4. ensure the integrity of the reference between the borrowing information table and the user table and the book information table;
5. Limit the maximum number of books that each user can borrow
6. If a new user is registered or a new book is stored in the database, the unique ID is automatically generated.
7. Support the following report requirements:
(No specific description, no need to write implementation statements, but in database design, ensure that these reports can be implemented using up to one SQL statement)
A) Daily Statistical Report: report on the number of books borrowed on the current day and the number of books repaid on the current day;
B) Real-time reports:
I. The number and number of books lent to each type of books;
Ii. List of all expired books and users in the current system and their Expiration days
Iii. Number of books borrowed by all users in the current system, which are listed by users (including those who do not borrow books). Please write the SQL statement to meet this requirement:

Database Application:
Write a series of SQL statements to describe the complete borrowing and returning behaviors, and ensure the execution integrity of these SQL statements.
The next question is the most important test of the test ability. If it cannot be completed, we will not be able to give the judgment result! Therefore, please write out a detailed answer and ensure that the answer is a program that can be executed. Email the results to your hr@88keke.com mailbox within two days

In combination with your design in question 2, a database implementation requires a three-tier or multi-tier structure and object-oriented programming. If possible, design a template mechanism for implementation.

Function: lists the current books lent by date.

ID: User Name, book name, book number, lending date
1. Zhang Jin dyeing workshop 12576587--1
2. Liu xingxi Travel Notes 32131098--2
......

Interview question 5
1. in PHP, the name of the current script (excluding the path and query string) is recorded in the predefined variable (1), and the URL linked to the current page is recorded in the predefined variable (2).

2. Execution Section <? Php echo 8% (-3)?> Output (3 ).

3. In HTTP 1.0, Status Code 401 indicates (4). If the "file not found" prompt is returned, the header function is available. The statement is (5 ).

4. The role of the Array Function arsort is (6); the role of the statement error_reporting (2047) is (7 ).

5. The format of the database connection string in PEAR is (8 ).

6. Write a regular expression and overwrite all JS/VBS scripts on the webpage (that is, remove the script tag and its content): (9 ).

7. install PHP using the Apache module in the http. in the conf file, first use statement (10) to dynamically load the PHP module, and then use Statement (11) to make Apache process all files with the extension of php as PHP scripts.

8. the statement include and require can both include another file to the current file. The difference is (12). To avoid multiple inclusion of the same file, you can use the statement (13) to replace them.

9. attributes of the class can be serialized and saved to the session, so that the entire class can be restored later. The function used is (14 ).

10. A function parameter cannot be a reference to a variable unless (15) is set to on.

11. The meaning of left join in SQL is (16 ). If tbl_user records the student's name and student ID, tbl_score records the student's student ID (ID) (which is not recorded after some students take the test) to print the name of each student and the total score of each subject, use the SQL statement (17 ).

12. In PHP, heredoc is a special string whose end mark must be (18 ).

13. Write a function to traverse all files and subfolders in a folder.

14. Briefly describe the implementation principles of unlimited classification in the Forum.

15. Design a webpage so that a full screen window is displayed when it is opened, which contains a text box and a button. After entering information in the text box, you can click the button to close the window, but the entered information is displayed on the main 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-give you three numbers and write the program to find the maximum value.
2-Advantages and Disadvantages of asp, php, and jsp
3-Introduction to mvc
4-Write the SQL statement for the top 10 people with the most posts. Use the following table:
Members (id, username, posts, pass, email)

Interview question 8
1-how to use javascript to determine whether a window has been blocked.
2-Write the session Running Mechanism
3-there is an array $ a = array (, 2); sort it again and list it in ascending order.
4-which of the following functions are used to prevent SQL injection vulnerabilities.
5-query the number of online users and handle SQL statements with exceptions or dropped lines

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.