Home > Article > Backend Development > Summary of PHP interview questions, summary of PHP test questions_PHP tutorial
1. Use PHP to print out the time of the previous day in the format of 2014-01-13 12:10:21 (2 points)
2. The difference between echo(), print() and print_r() (3 points)
3. Templates that enable HTML and PHP to be used separately (1 point)
4. What tools are used for version control? (1 point)
5. How to implement string flipping? (3 points)
——————————————————————
6. Methods to optimize MYSQL database. (4 points, write more and get more)
7. The meaning of PHP (get 1 point)
8. What is the function that MYSQL uses to obtain the current time?, and the function that formats dates is (2 points)
9. A method to intercept Chinese text strings without garbled characters. (3 points)
——————————————————————
10. Have you ever used version control software? If so, what is the name of the version control software you used? (1 point)
11. Have you ever used a template engine? If so, what is the name of the template engine you used? (1 point)
12. Please briefly describe your most proud development work (4 points)
13. For websites with large traffic, what methods do you use to solve the traffic problem? (4 points)
————————————————————————
14. Use PHP to write the code to display the client IP and server IP (1 point)
15. What is the difference between the include and require statements? To avoid including the same file multiple times, you can replace them with (?) statements? (2 points)
16. How to modify the survival time of SESSION (1 minute).
17. There is a web page address, such as Keleyi’s homepage: http://keleyi.net/default.htm, how to get its content? ($1 point)
18. In HTTP 1.0, the meaning of status code 401 is (?); if the prompt "File not found" is returned, the header function can be used, and its statement is (?); (2 points)
19. In PHP, heredoc is a special string, and its end mark must be? (1 point)
20. Talk about the advantages and disadvantages of asp, php and jsp (1 point)
21. Talk about your understanding of mvc (1 point)
——————————————————————-
22. Write the SQL of the names of the ten people with the most posts, using the following table: members (id, username, posts, pass, email) (2 points)
23. 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? (2 points)
24. What is the function of error_reporting in PHP? (1 point)
25. Please write a function to verify whether the format of the email is correct (2 points)
26. Briefly describe how to get the current execution script path, including the obtained parameters. (2 points)
27. How to modify the survival time of SESSION. (1 point)
——————————————————————–
28. What is the function to pop up a dialog box in a JS form? What is the function to get input focus? (2 points)
29. What is the redirection function of JS? How to introduce an external JS file? (2 points)
30. What is the difference between foo() and @foo()? (1 point)
31. How to declare a class named "myclass" without methods and attributes? (1 point)
32. How to instantiate an object named "myclass"? (1 point)
33. How do you access and set the properties of a class? (2 points)
34. What is the difference between mysql_fetch_row() and mysql_fetch_array? (1 point)
——————————————————————–
35. What is the GD library used for? (1 point)
36. Point out some ways to enter a piece of HTML code in PHP. (1 point)
37. Which of the following functions can open a file for reading and writing? (1 point)
(a) fget() (b) file_open() (c) fopen() (d) open_file()
38. Which of the following options does not add john to the users array? (1 point)
(a) $users[] = 'john';
(b) array_add($users,'john' );
(c) array_push($users,'john');
(d) $users ||= 'john';
39. Will the following program be input? (1 point)
$num = 10;
function multiply(){
$num = $num * 10;
}
multiply();
echo $num;
?>
40. Use PHP to write a simple query to find out all the content named "Zhang San" and print it out (2 points)
Table name UserName Tel Content Date
Zhang San 13333663366 College graduate 2006-10 -11
around through 136123. ious 136123. Around 136123. ( "local","root","pass");
@mysql_select_db("DB",$mysql_db);
41. How to use the following class and explain what it means? (3)
class test{
$num=md5(md5($num). "En");
return $num;
}
}
——————————————————————————-
Table name UserName Tel Content Date
Zhang San 13333663366 College graduate 2006-10-11 Zhang San 13612312331 Undergraduate Graduation 2006-10-15
wealth wealth in in ininging in in on in 2006-10-15 In the table
(b) Please use sql statement to update Zhang San’s time to the current system time
(c) Please write to delete all records named Zhang Si
43. Please write the meaning of data type (int char varchar datetime text); what is the difference between varchar and char (2 points)
44. MySQ auto-increment type (usually table ID field) must be set to (?) field (1 point)
45. Write the output result of the following program (1 point)
$b=201;$c=40;
$a=$b>$c?4:5; echo $a;
?>
46. Is there a function that detects whether a variable is set? What is the function that detects whether it is empty? (2 points)
————————————————————————————
47. What is the function to obtain the total number of query result sets? (1 point)
48. $arr = array('james', 'tom', 'symfony'); Please print out the value of the first element (1 point)
49. Please separate the array values in question 41 with ',' signs and merge them into string output (1 point)
50. $a = 'abcdef'; Please take out the value of $a and print out the first letter (1 point)
51. Can PHP be connected to databases such as sql server/oracle? (1 point)
52. Please write the PHP5 permission control modifier (3 points)
53. Please write down the constructor and destructor of php5 (2 points)
——————————————————————————
54. Please use PHPMYADMIN to complete the following
(1) Create a news release system. The table name message has the following fields (3 points)
id article idtitle article title
content article content category_id article category id
hits Click count
(2) The same news release system as above: The comment table records the user's reply content. The fields are as follows (4 points)
comment_id reply id
id article id, associated with the id in the message table
Now you need to get a list of article titles in the following format by querying the database, and sort them 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 the article has no replies, the number of replies will be displayed as 0
(3) In the above content management system, the table category stores classification information. The fields are as follows (3 points)
category_id int(4) not null auto_increment;
category_name varchar(40) not null;
Write how to implement this drop-down menu
Fill in the blanks
1. In PHP, the name of the current script (excluding path and query string) is recorded in predefined variables; and the URL linking to the current page is recorded in predefined variables.
2. The execution program segment will be output.
3. In HTTP 1.0, the meaning of status code 401 is; if a "File not found" prompt is returned, the header function can be used, and its statement is.
4. The function of array function arsort is; the function of statement error_reporting(2047) is.
5.The database connection string format in PEAR is.
6. Write a regular expression to filter all JS/VBS scripts on the web page (that is, remove the scrīpt tag and its content):.
7. Install PHP as an Apache module. In the file http.conf, you must first use statements to dynamically load the PHP module, and then use statements to make Apache process all files with the extension php as PHP scripts.
8. The statements include and require can include another file into the current file. The difference between them is that in order to avoid including the same file multiple times, you can use statements to 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.
10. The parameter of a function cannot be a reference to a variable, unless it is set to on in php.ini.
11.The meaning of LEFT JOIN in SQL is. 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 statements.
12. In PHP, heredoc is a special string, and its end mark must be.
Programming questions
1. Write a function to extract the file extension from a standard URL as efficiently as possible
For example: http://keleyi.com/a/bjac/4w0otu4n.htm needs to extract htm or .htm
2. In HTML language, the meta tag in the header of the page can be used to output the encoding format of the file. The following is a standard meta statement
Please use PHP language to write a function to convert a standard HTML page into Similar to the charset part of the meta tag, the value is changed to big5
Please note:
1. Need to process the complete html page, that is, not just this meta statement
2. Ignore case
3. ' and " They are interchangeable here
4. The quotation marks on both sides of 'Content-Type' can be ignored, but the quotation marks on both sides of 'text/html; charset=gbk' are not acceptable
5. Pay attention to handling extra spaces
3. Write a function to calculate the relative paths of two files
For example, $a = '/a/b/c/d/e.php';
$b = '/a/b/ 12/34/c.php';
Calculate the relative path of $b relative to $a should be ../../c/d and add ()
Write a function that can traverse all files and subfolders in a folder.