PHP interview is often asked to summarize the knowledge points, very useful for you

Time:2021-3-3

Article from:mp.weixin.qq.com/s/Fq7LByOiUXg0Z7Q…

Learning materials sharing:【Videos, documents, interview questions





These are the knowledge points often asked in PHP interview. Only pointed out that the knowledge points, the corresponding also need to find their own information system learning. I hope you can not only understand what it is, but also understand why and the principle behind it.

If you are in the following states, this information is very suitable for you:

  • I’m going to change my job. I don’t know where to start
  • Technology meets bottleneck, don’t know what to learn
  • I’m ready to learn PHP, but I don’t know how deep my field is

Fundamentals

  • Learn about most array processing functions
  • String processing function MB_ Series function
  • &Based on the case study, this paper introduces the case study
  • ==The difference between = = = and
  • The difference between issue and empty
  • Understanding of all magic functions
  • The difference between static, $this and self
  • Differences among private, protected, public and final
  • OOP thought
  • Abstract class and interface use scenarios respectively
  • What is a trait
  • echo、print、print_ R distinction (distinguish expression from statement)
  • __ Construct and__ Destruct difference
  • Static action (distinguish class and function) manual, sof
  • __ Tostring() function
  • The difference between “single quotation mark” and “double quotation mark”
  • What are the common HTTP status codes
  • 301 what do you mean 404?

Advanced

  • Autoload, composer principle psr-4, principle

  • Session sharing, survival time

  • exception handling

  • How to iterate objects

  • How to array the operation object $obj [key];

  • How to functionalize the object $obj (123);

  • What is yield? Let’s talk about a usage scenario yield

  • What is PSR, psr-1, 2, 4, 7

  • How to get client IP and server IP address

  • Client IP

  • Server IP

  • Understand the concept of proxy through the actual IP

  • How to open PHP exception prompt

  • php.ini Open display_ Errors setting error_ Reporting level

  • When running, use ini_ Set (k, V); dynamic setting

  • How to return a 301 redirection

  • [warning] be careful that the script will continue to execute after setting 301. Don’t think that it won’t be executed below. Use die or exit when necessary

  • How to get the extension installation path

  • Phpinfo(); page lookup extension_ dir

  • Command line PHP – I | grep extension_ dir

  • Run time echo ini_ get(‘extension_ dir’);

  • String, the principle of comparing the size of the number, pay attention to the beginning of 0 octal, the beginning of 0 hexadecimal

  • String comparison size, from left (high order) to right, character by character ASCII comparison

  • What is the BOM header and how to remove it

  • 0xEF,0xBB,0xBF

  • Detection and removal

  • What is MVC

  • Implementation principle of dependency injection

  • How to execute command asynchronously

  • What is the template engine, what problems to solve, and how to implement it (Smarty, twig, blade)

  • How to realize chain operation $obj – > W () – > m () – > d ();

  • How to use xhprof and Xdebug performance debugging tools

  • What is the difference between index array [1,2] and associative array [‘k1 ‘= > 1,’ K2 ‘= > 2]

  • How to use the cache and the scene

Practice

  • Given a two-dimensional array, sort by a field
  • How to determine the type of uploaded file, such as: only JPG is allowed to upload
  • Do not use temporary variables to exchange the values of two variables $a = 1; $B = 2; = > $a = 2; $B = 1;
  • Strtoupper has garbled code when converting Chinese, how do you solve it? PHP echo strtoupper (‘ab Hello C ‘);
  • Differences among websocket, long polling and server sent events (SSE)
  • What is the meaning of “heads already sent” error and how to avoid it

Algorithm

  • Quick sort (handwriting)
  • Bubble sort (handwritten)
  • Binary search
  • Search algorithm KMP (understanding)
  • Depth, breadth first search (understanding)
  • LRU cache elimination algorithm (understand that memcached uses this algorithm)

Data structure (understanding)

  • Heap and stack characteristics
  • queue
  • Hashtable
  • Linked list

Contrast

  • The difference between cookie and session
  • The difference between get and post
  • The difference between include and require
  • include_ Once and require_ Once difference
  • Difference between memcached and redis
  • MySQL storage engines and their differences (I will definitely ask the difference between MyISAM and InnoDB)
  • The difference between HTTP and HTTPS
  • The difference between Apache and nginx
  • The difference between define() and Const
  • What is the difference between traits and interfaces and what pain points does traits solve?
  • The difference between GIT and SVN

Database

  • MySQL

  • Index, union index (hit criteria)

  • Sub warehouse sub table (horizontal sub table, vertical sub table)

  • partition

  • Be able to use explain to analyze SQL performance problems and understand the meaning of parameters

  • Slow log

  • Focus on understanding type, rows and key

  • CRUD

  • JOIN、LEFT JOIN 、RIGHT JOIN、INNER JOIN

  • UNION

  • Group by + count + where combination case

  • Common MySQL functions, such as: now(), md5(), concat(), uuid(), etc

  • 1: 1, 1: n, N: n are applicable to each scene

  • Understand what triggers are and describe a usage scenario

  • Database optimization means

  • MSSQL (understanding)

  • Query the latest 5 pieces of data

  • NOSQL

  • Persistence

  • Support multiple data types

  • Multi core CPU

  • Memory elimination mechanism

  • Cluster

  • Support SQL

  • Performance comparison

  • Support services

  • Application scenarios

  • Redis、Memcached、MongoDB

  • Comparison, applicable scenarios (can be compared from the following dimensions)

  • What problems did you use before to solve? Why did you choose it?

Server

  • Check CPU, memory, time, system version and other information
  • Find and grep find files
  • Awk processing text
  • View the directory of the command
  • Have you ever compiled PHP yourself? How to open the readLine function
  • How to check the memory and CPU usage of PHP process
  • How to add an extension to PHP
  • Modify PHP session storage location and ini configuration parameters
  • What kinds of load balancing are there? Choose one you are familiar with and explain its principle
  • How does master-slave replication M-S synchronize? Push or pull? Will it be out of sync? What should I do?
  • How to ensure the availability of data, even if the database is deleted, it can be restored to the minute level. What would you do.
  • Too many database connections, exceeding the maximum, how to optimize the architecture. What is the convenient way to deal with it?
  • 502 what’s the reason? How to check 504?

Architecture

  • Partial operation and maintenance (understanding)

  • Load balancing (nginx, haproxy, DNS)

  • Master slave replication (mysql, redis)

  • Data redundancy and backup (MySQL incremental and full principle)

  • Monitoring and inspection (divided into two dimensions: survival and service availability)

  • Purpose and principle of MySQL, redis, memcached proxy and cluster

  • Slicing

  • High availability cluster

  • RAID

  • Source code compilation and memory tuning

  • cache

  • Where cache is needed in work and why

  • Search solutions

  • performance tuning

  • Monitoring scheme of each dimension

  • Centralized processing scheme of log collection

  • internationalization

  • Database design

  • Static scheme

  • Draw the common PHP application architecture diagram

Framework

  • ThinkPHP (TP), CodeIgniter (CI), Zend (non OOP Series)

  • YAF, Phalcon (C extension system)

  • Yii, laravel, symfony (pure OOP Series)

  • Spool, workerman (network programming framework)

  • Contrast the frame to distinguish several direction points

  • Is it pure OOP

  • Loading method of class library (self written autoload vs. composer standard)

  • Ease of use direction (CI basic framework, laravel this is the high development efficiency framework and the number of basic components)

  • Black box (compared with C extension system)

  • Running speed (e.g. laravel loads a lot of things)

  • Memory footprint

Design pattern

  • Singleton mode (emphasis)
  • Factory mode (focus)
  • Observer model (focus)
  • Dependency injection (focus)
  • Decorator mode
  • proxy pattern
  • Combination mode

Safety

  • SQL injection
  • XSS and CSRF
  • Input filtering
  • Cookie security
  • Disable MySQL_ Coefficient function
  • When the database stores the user password, what should be done to ensure the security
  • Verification code session problem
  • Secure session ID (even after interception, it cannot be used in simulation)
  • Directory permission security
  • Contains local and remote files
  • File upload PHP script
  • Eval function execution script
  • disable_ Functions close high risk functions
  • FPM independent users and groups, give each directory specific permissions
  • Understand the difference between hash and encrypt

High level

  • PHP array bottom layer implementation (hashtable + linked list)
  • Copy on write principle, when GC
  • PHP process model, process communication mode, process thread difference
  • What is the core principle of yield
  • PDO prepare principle
  • What is the difference between PHP 7 and PHP 5
  • Swoole application scenarios, collaborative implementation

Front end

  • Get DOM node, attribute

  • Box model

  • CSS file, style label, inline style attribute priority

  • HTML and JS running order (page JS from top to bottom)

  • JS array operation

  • Type judgment

  • This scope

  • . map() and this specific use scenario analysis

  • Cookie reading and writing

  • JQuery operation

  • Ajax request (synchronous, asynchronous) random number no caching

  • What are the benefits of bootstrap

  • N solutions for cross domain requests

  • New technology (understanding)

  • ES6

  • modularization

  • pack

  • Building tools

  • vue、react、webpack、

  • Front end MVC

  • optimization

  • Browser single domain name concurrency limit

  • Static resource cache 304 (if modified since and Etag principles)

  • Combining multiple small icons and using position positioning technology to reduce requests

  • Static resources are combined into a single request and compressed

  • CDN

  • Static resource delay loading technology and preloading technology

  • keep-alive

  • Optimization of CSS in the head and JS in the tail (principle)

Network

  • IP address to int
  • What does 192.168.0.1/16 mean
  • What is the main function of DNS?
  • The difference between IPv4 and V6

Network programming

  • TCP three handshake process
  • The differences between TCP and UDP are applicable to different scenarios
  • What can guarantee UDP high availability
  • How to solve the problem of TCP packet sticking?
  • Why do you need a heartbeat?
  • What is long connection?
  • How is HTTPS secure?
  • The difference between stream and datagram
  • There are several ways of interprocess communication. Which is the fastest?
  • What happens to fork()?

API

  • What is restful
  • How to be compatible with delete requests on browsers that do not support delete requests
  • App of common API_ ID APP_ What is the main function of secret? Describe the next process
  • How can API requests ensure that data is not tampered with?
  • The difference between JSON and jsonp
  • Difference between data encryption and signature verification
  • What is RSA
  • How to deal with API version compatibility
  • Current limiting (wooden bucket, token bucket)
  • What scenarios is OAuth 2 mainly used in
  • JWT
  • JSON in PHP_ Encode ([‘key ‘= > 123]); and return JSON_ Encode ([]); what is the difference? How to solve it

This work adoptsCC agreementReprint must indicate the author and the link of this article