


The most comprehensive summary of PHP interview questions and answers in 2017
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 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 QuestionsSharing PHP Interview QuestionsThe 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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

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

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
