Home  >  Article  >  Backend Development  >  PHP programmer interview questions (Sina)

PHP programmer interview questions (Sina)

WBOY
WBOYOriginal
2016-07-25 08:59:24983browse
This article introduces an interview question that is said to be a PHP programmer interview question from Sina Company. Friends in need can refer to it.

Sina PHP Engineering Written Exam Questions 1. Write a function to retrieve the file extension from a standard URL as efficiently as possible For example: http://www.sina.com.cn/abc/de/fg.php?id=1 You need to remove php or .php

2. In HTML language, the meta tag at the head 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 change the charset part value in a similar meta tag in a standard HTML page to big5 Please note: (1) Need to process the complete html page, that is, not only this meta statement (2) Ignore case (3) ' and " 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' cannot be ignored. (5) Pay attention to handling extra spaces

3. Write a function to calculate the relative paths of two files Such as $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 add ()

4. Write a function that can traverse all files and subfolders in a folder.

5. Briefly describe the implementation principle of unlimited classification in the forum.

6. Design a web page so that a full-screen window pops up when it is opened, 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

Online answer section 1. Write a function to retrieve the file extension from a standard URL as efficiently as possible

2. For example: http://www.sina.com.cn/abc/de/fg.php?id=1 You need to remove php or .php

3. Both truncation and regularization are possible, but where is the high performance reflected in this list? (The question is very 2)

4. 5.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

6.

7. Please use PHP language to write a function to change the charset part value in a similar meta tag in a standard HTML page to big5

8. Please note:

9. (1) The complete html page needs to be processed, that is, not just this meta statement

10. (2) Ignore case

11. (3) ' and " are interchangeable here

12. (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 allowed

13. (5) Pay attention to extra spaces

14. Both character processing and regularization are possible. Note what does 1 mean? Are you afraid that people will mistakenly think that you only deal with this sentence? The person who asked the question probably wanted to test regular expressions. In actual application, it is indeed best to use regular expressions plus characters, because there are too many abnormal ways of writing meta. (Judging from the question, the person who asked the question didn鈥檛 play much, so the question is number 2)

15. 16.3. Write a function to calculate the relative paths of two files

17. Such as $a = '/a/b/c/d/e.php'; 18. $b = '/a/b/12/34/c.php';

19. Calculate the relative path of $b relative to $a should be ../../c/d and add ()

20. The solution is explode, but I don鈥檛 understand what is the use of this specific practice?

21. 22.4. Write a function that can traverse all files and subfolders in a folder.

23. Recursion, familiar functions, meaningless questions (the question maker is very 2)

24. 25.5. Briefly describe the implementation principle of infinite classification in the forum.

26. I forgot, there is a lot of stuff on the Internet, are you just doing forums on Sina? Is discuz popular in Sina forums? (The person who asked the question is 2) 27. 28.6. 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.

29. I don鈥檛 know, but you can refer to some pop-up calendars. Click on the pop-up calendar window, then select the date, close the window, and enter the date into the designated box. Is there anything in Sina that people are willing to input? (The person who asked the question is very 2)

That鈥檚 it, interview questions about PHP. The writing is a bit messy, so please just refer to it, mainly to understand the problem ideas and implementation methods, so that they can be used in future job applications,



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn