Home Backend Development PHP Tutorial The most comprehensive summary of PHP interview questions and answers in 2017

The most comprehensive summary of PHP interview questions and answers in 2017

May 14, 2018 pm 02:14 PM
php Answer

Recently, I have seen many friends on the Internet asking how to deal with PHP interviews. This is no problem for friends with work experience and practical projects, but for friends who have just learned PHP, PHP interview is a very important step, so today PHP Chinese website will give you a summary of PHP interview questions, many of which are encountered by many programmers during interviews! Hope it helps you!

Part 1: Basic PHP interview questions

1. A major of PHP language The advantage is cross-platform. What is cross-platform?

The optimal combination of PHP's operating environment is Apache+MySQL+PHP. This operating environment can be configured on different operating systems (such as windows, Linux, etc.) and is not subject to manipulation. System limitations, so it’s called cross-platform

2. Tell me what web front-end technologies you have mastered?

Proficient in DIV+CSS web page layout, JavaScript, jQuery framework, photoshop image processing

3. Program now MVC three-layer structure is often adopted in the Internet. Which three layers does MVC refer to and what are its advantages?

The three layers of MVC refer to: business model, view, and controller. The controller layer calls the model to process the data, and then maps the data to the view layer for display. , the advantages are: ① It can achieve code reusability and avoid code redundancy; ② M and V realize code separation, so that the same program can use different expressions

4. Understanding of json data format?

JSON (JavaScript Object Notation) is a lightweight data exchange format. The json data format is fixed and can be used in a variety of ways. Language is used to transfer data

The function in PHP that handles json format is json_decode(string $json [, bool $assoc]), which accepts a JSON format string and converts it into a PHP variable, parameter json A string in json string format to be decoded. assoc When this parameter is TRUE, it will return array instead of object;

Json_encode: Convert PHP variables into json format

5. What are the advantages of AJAX?

ajax is an asynchronous transmission technology that can be implemented through javascript or the JQuery framework to achieve partial refresh, which reduces the pressure on the server and improves user experience. Experience

#6. In the development of the program, how to improve the operating efficiency of the program?

① Optimize SQL statements, try not to use select * in query statements, use which field to check which field; use less subqueries and can be replaced by table connections; use less Fuzzy query;

②Create an index in the data table;

③In the program Generate cache for frequently used data;

##7.PHP Commonly used functions for processing arrays? (Focus on the 'parameters' and 'return value' of the function)

①array() creates an array;

②count() Returns the number of elements in the array;

③array_push() inserts one or more elements into the end of the array (push);

④array_column () Returns the value of a single column in the input array;

array_combine() Creates a new array by merging two arrays;

array_reverse() Returns the array in reverse order;

⑦array_unique() deletes duplicate values ​​in the array;

⑧in_array() checks whether the specified value exists in the array;

8. Commonly used functions for PHP to process strings?

①trim() removes blank characters and other characters on both sides of the string;

substr_replace() Replace part of the string with another string;

③substr_count() Count the number of times a substring appears in the string;

④substr() returns a part of the string;

⑤strtolower() converts the string to lowercase letters;

⑥strtoupper() Convert the string to uppercase letters;

⑦strtr() converts specific characters in the string;

⑧strrchr() finds the string in The last occurrence of a string in another string;

⑨strstr() finds the first occurrence of a string in another string (case-sensitive); strrev() reverses String; strlen() returns the length of the string; str_replace() replaces some characters in the string (case sensitive); print() outputs one or more strings; explode() breaks the string into an array ; is_string() detects whether the variable is a string; strip_tags() removes HTML tags from a string; mb_substr() is used to intercept Chinese and English functions

Part 2: Database part of PHP interview questions

#1. What are the common relational database management system products?

Answer: Oracle, SQL Server, MySQL, Sybase, DB2, Access, etc.

2. What is a transaction? and its characteristics?

Answer: Transaction: It is a series of database operations and is the basic logical unit of database application.

Transaction characteristics:

(1) Atomicity: that is, indivisibility. Either all transactions are executed or none are executed.

(2) Consistency or stringability. The execution of a transaction converts the database from one correct state to another correct state

(3) Isolation. Before the transaction is correctly committed, any changes to the data by the transaction are not allowed to be provided to any other transaction,

(4) Persistence. After a transaction is submitted correctly, its results will be permanently saved in the database. Even if there are other failures after the transaction is submitted, the processing results of the transaction will be saved.

Or understand it this way:

A transaction is a group of SQL statements that are bound together as a logical unit of work. If any statement operation fails, the entire operation will fail, and subsequent operations will Roll back to the state before the operation, or there is a node on it. To ensure that something is either executed or not executed, transactions can be used. To consider a grouped statement as a transaction, it needs to pass ACID tests, namely atomicity, consistency, isolation and durability

3. What is the difference between char and varchar?

Answer: It is a fixed-length type, while varchar is a variable-length type. The difference between them is:

In a data column of type char(M), each value occupies M bytes. If a certain length is less than M, MySQL will pad it with space characters on the right. (Padding space characters will be removed during the search operation.) In a varchar(M) type data column, each value only takes up just enough bytes plus one byte to record its length ( That is, the total length is L+1 bytes).

4. Mysql storage engine, the difference between myisam and innodb.

Answer: Simple expression:

MyISAM is a non-transactional storage engine; suitable for frequent Query application; table lock, no deadlock; suitable for small data, small concurrency

innodb is a storage engine that supports transactions; suitable for applications with many insert and update operations; row lock if designed properly (The biggest difference lies in the lock level); suitable for big data and large concurrency.

5. What are the data table types?

## Answer: MyISAM, InnoDB, HEAP , BOB, ARCHIVE, CSV, etc.

MyISAM: Mature, stable, easy to manage, and fast to read. Some functions do not support (transactions, etc.), table-level locks.

InnoDB: supports transactions, foreign keys and other features, and data row locking. It takes up a lot of space and does not support full-text indexing, etc.

Part Three: PHP Interview Questions: Object-Oriented

1. What is object-oriented? (Answer with understanding)

## Answer: Object-oriented OO = Object-oriented analysis OOA + Object-oriented design OOD + Object-oriented programming OOP; The popular explanation is that "everything is an object", and all things are regarded as independent objects (units). They can complete their own functions by themselves, rather than being divided into functions like C.

The current pure OO languages ​​are mainly Java and C#. PHP and C++ also support OO. C is process-oriented. ​

#2. Briefly describe the access rights of private, protected, and public modifiers.

Answer: private: Private members can only be accessed inside the class.

protected: Protected members, accessible within the class and inherited classes.

public: Public members, completely public, no access restrictions.

3. What is the difference between heap and stack?

Answer: The stack is a memory space allocated during compilation, so the size of the stack must be clearly defined in your code;

The heap is where the program runs During the dynamically allocated memory space, you can determine the size of the heap memory to be allocated based on the running status of the program.

4. What are the characteristics of object-oriented?

Answer: Mainly include encapsulation, inheritance, and polymorphism. If it is 4 aspects, add: abstraction.

5. What is a constructor, what is a destructor, and what is its function?

Answer: The constructor (method) is the first method automatically called by the object after the object is created. It exists in every declared class and is a special

member method. Its function is to perform some initialization tasks. In Php, construct() is used to declare a constructor method, and only one can be declared.

The destructor (method) has the opposite effect to the constructor. It is the last method automatically called by the object before it is destroyed. It is a newly added content in PHP5 that is used to perform some specific operations before destroying an object, such as closing files and releasing memory.

Summary:

#php interview questions are different for each company, here we provide some We have summarized the more commonly encountered PHP interview questions, but you can also expand and extend yourself based on the PHP interview questions we summarized!

##Related recommendations:

1.

2017 Recruitment Season: Super Summary of PHP Interview Questions! 2.

11 Most Frequently Asked PHP Interview Questions

3.

Sharing PHP Interview Questions

The above is the detailed content of The most comprehensive summary of PHP interview questions and answers in 2017. For more information, please follow other related articles on the PHP Chinese website!

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
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)

Hot Topics

Java Tutorial
1668
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP vs. Other Languages: A Comparison PHP vs. Other Languages: A Comparison Apr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

See all articles