Home Backend Development PHP Tutorial A PHP interview question_PHP tutorial

A PHP interview question_PHP tutorial

Jul 13, 2016 am 10:33 AM
php interview

  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 linking to the current page is recorded in the predefined variable (2).
  2. echo $_SERVER['PHP_SELF']; echo $_SERVER["HTTP_REFERER"];

  3. Execution program segmentwill output (3).
  4. 0

  5. In HTTP 1.0, the meaning of status code 401 is (4); if a "File not found" prompt is returned, the header function can be used, and its statement is (5).
  6. (4) Unauthorized (5) header("HTTP/1.0 404 Not Found");

  7. The function of array function arsort is (6); the function of statement error_reporting(2047) is (7).
  8. (6) Reverse sort the array and maintain the index relationship (7)All errors and warnings

  9. The database connection string format in PEAR is (8).
  10. Write a regular expression to filter all JS/VBS scripts on the web page (that is, remove the tags and their contents): (9).
  11. /<[^>].*?>.*?/si

  12. To install PHP as an Apache module, first use statement (10) in the file http.conf 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.
  13. (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

  14. The statements include and require can both 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 replace them with statement (13).
  15. (12) include generates a warning when an exception occurs and require generates a fatal error (13) require_once()/include_once()

  16. The 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).
  17. serialize() /unserialize()

  18. The parameter of a function cannot be a reference to a variable, unless (15) is set to on in php.ini.
  19. allow_call_time_pass_reference

  20. 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 number (ID), test score (score), and test subject (some students were expelled after taking the exam, and there is no record of them). 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).
  21. (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

  22. In PHP, heredoc is a special string, and its end flag must be (18).
  23. The line containing the terminating identifier cannot contain any other characters except ";"

  24. Write a function that can traverse all files and subfolders in a folder.
  25. /**
    * 遍历目录,结果存入数组。支持php4及以上。php5以后可用scandir()函数代替while循环。
    * @param string $dir
    * @return array
    */
    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;
        }
    } 
    Copy after login
  26. Briefly describe the implementation principle of unlimited classification in the forum.
  27. 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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/752569.htmlTechArticleIn PHP, the name of the current script (excluding path and query string) is recorded in a predefined variable (1 ); and the URL linking to the current page is recorded in the predefined variable (2). ech...
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles