PHP preliminary interview questions

Source: Internet
Author: User
Tags install php redis regular expression require script tag


I. Front-end

What is the engine used by Firefox and google? (At least the basics of the previous section, the compatibility of the browser for stream adjustment is required. It is also required to use CSS3 and HTML5)
Firefox uses Gecko, while Safari and Chrome use Webkit. The latest version of opera also uses webkit.
 
How to use CSS to realize horizontal and vertical center? (Basic)
Horizontal center: text-align: center; margin: 0 auto
Vertical center: you can set the container to display: table, and then set the sub-element, that is, the element to be vertically centered, to display as display: table-cell, and then add vertical-align: to achieve this. Or use {top: 50%; transform: translateY (-50% );}
The above are not perfect implementations, but they are all the basis. It is a liar who has no idea at all.
 
How to deal with jQuery conflicts? (Basic)
JQuery. noConflict (); or use a closure.
(Function ($) {}) (jQuery );
 
II. Data storage
How to locate statements with low efficiency in MySQL?
Use show full processlist and slow query logs.
 
Have you performed the incremental backup master/slave service for the database?
The key point is the binlog, which is the binary log.
 
What is the comparison between MYISAM engine and INNODB engine?
Key points: Table lock row lock, whether transaction and index storage are supported, applicable scenarios
 
If the interviewer mentioned in his resume that he is familiar with memcache, he asked: What is the default port of memcache? What is the maximum length of Value? What is the default cache validity period?
Answer: Port: 11211, the maximum value is 1 M, and the validity period is 30 days. Two of the three questions are the scammers.
If redis is mentioned, what is the maximum value of redis? Which data type is used to store ordered and unordered sets? Which Command initiates a transaction? Which two persistence methods are available?
Answer: The maximum value is 512 MB. list and sorted set are used in sequence, and set is used unordered. multi is used for initiating transactions. Memory snapshots and log appending are used for persistence.
 
PHP section:

How to implement automatic loading of classes?
Spl_autoload_register: The answer _ autoload is that it has never been done.
 
How many PHP magic methods are listed?
_ Set () ,__ get () ,__ construct () ,__ call () ,__ toString (). There are a total of 14 or 5 objects, and no four of them can be answered. The familiarity with object orientation is a nonsense.
 
Which of the following is a case-insensitive modifier for a regular expression? How can I determine whether the email format is correct without regular expressions?
Answer: I. It is better to use filter functions if they can be output.
 
4. What are the basic processes of MVC at each layer? Have you implemented the MVC framework?
 
 
Servers and others

In linux, which Resource Manager command is similar to win? How can I check the services that are automatically started at startup? Which service implements a scheduled task? What command is used to delete non-empty folders?
Answer: top; chkconfig-list; crontab; rm-r;
 
A common technical community.

Additional item


* 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% (-2)?> 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. conf file, first use the statement (10) to dynamically load the PHP module,
Then, use the 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 name and student ID ),
Tbl_score records the student's student ID (ID), score (score), and subject (subject ),
To print the student name and the total score of each subject, you can use 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.

// Answer (fill in the blanks ):

1. echo $ _ SERVER ['php _ SELF ']; echo $ _ SERVER ["HTTP_REFERER"];
2. 0
3. (4) unauthorized (5) header ("HTTP/1.0 404 Not Found ");
4. (6) reverse sort the array and maintain the index relationship (7) All errors and warnings
5. Not clear
6./<script [^>]. *?>. *? </Script>/si
7. (10) LoadModule php5_module "D:/xampp/apache/bin/php5apache2. dll"
 
(11) AddType application/x-httpd-php-source. phps
AddType application/x-httpd-php. php. php5. php4. php3. phtml
8. (12) when an exception occurs, include generates a warning. require generates a fatal error (13) require_once ()/include_once ()
9. serialize ()/unserialize ()
10. allow_call_time_pass_reference
11. (16) natural left outer join
(17) select name, count (score) as sum_score from tbl_user left join tbl_score on tbl_user.ID = tbl_score.ID group by tbl_user.ID
12. The row containing the end identifier cannot contain any other characters ";"

 

13.

/**
* Traverse the directory and save the result to an array. Php4 and above are supported. Php5 and later use the scandir () function to replace the while loop.
* @ Param string $ dir
* @ Return array
*/
Function my_scandir ($ dir)
{
$ Files = array ();
If ($ handle = opendir ($ dir )){
While ($ file = readdir ($ handle ))! = False ){
If ($ file! = "..." & $ File! = "."){
If (is_dir ($ dir. "/". $ file )){
$ Files [$ file] = rec_scandir ($ dir. "/". $ file );
} Else {
$ Files [] = $ file;
                 }
             }
         }
Closedir ($ handle );
Return $ files;
     }
}

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.