Home >Backend Development >PHP Tutorial >A PHP programmer interview question (basic type)
A relatively basic PHP programmer interview question. The test is relatively basic, but there are many details. If the foundation is not strong, it will be difficult to pass. Friends in need, please refer to it.
1. In PHP, the name of the current script (excluding path and query string) is recorded in the predefined variable (1); and the URL linking to the current page is recorded in the predefined variable (2). 2. Executing the program segment will output (3). 3. In HTTP 1.0, the meaning of status code 401 is (4); if the prompt "File not found" 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 treat all files with the extension php as PHP scripts. deal with. 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) 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 (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 mark must be (18). 13. Write a function that can traverse all files and subfolders in a folder. 14. Briefly describe the implementation principle of unlimited classification in the forum. 15. 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. //Answer (fill in the blank): 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. Didn’t understand 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) include generates a warning require when an exception occurs Fatal error occurs (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 line where the end identifier is located cannot contain Any other characters except ";"13./*** Traverse the directory and store the results in an array. Supports php4 and above. After php5, the scandir() function can be used 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; }}I hope the php interview questions provided above will be helpful to everyone. I wish you all good luck in finding a job. |