


10 PHP interview questions commonly used in IT company interviews in spring 2019!
Today, the editor of php Chinese website accidentally heard the interview questions on the road, so on a whim, I compiled 10 frequently asked questions in php interviews. If you have time, you can take a look.
Related recommendations: 2019 PHP interview questions summary (collection)
1. Which network protocol does nginx use?
Answer: nginx is the application layer. I think from bottom to top, the transport layer uses tcp/ip, the application layer uses http, and fastcgi is responsible for scheduling the process!
2.eho ,The difference between print and print_r?
Answer: echo is a language structure with no return value; print function is basically the same as echo, except that print is a function with return value; print_r is recursive printing. Used to output array objects.
3.What are the features of PHP?
Answer: ①.php uniquely mixes C, Java, Prel and PHP’s own syntax.
②. It can execute dynamic web pages faster than CGI or Prel. Compared with other programming languages, PHP embeds the program into the HTML document for execution. The execution efficiency is much higher than CGI that completely generates HTML editing. All CGI can be realized.
③.Supports almost all popular databases and operating systems.
④.PHP can use C and C for program expansion.
4. Find the subscript of the maximum number in the array?
Answer: 1.functionmaxkey($arr){
2.$maxval=max($arr);3. foreach($arras$key=>$val){4.if($maxval==$val){5.$maxkey=$key;6.}7.}8.return$maxkey;9.}
10.$arr=array(0,-1,-2,5,"b"=>15,3);11.echomaxkey($arr);
Output: b
5. For websites with large traffic, what method do you use to solve the traffic problem?
Answer: ①. Use cache effectively to increase cache hit rate.
②.Use load balancing.
③.Use CDN to store and accelerate static files.
④.Ideas to reduce the use of database.
⑤ .Check where the bottlenecks of statistics are.
6.Talk about the advantages and disadvantages of asp, php, jsp?
Answer: ①asp needs to rely on IIS, which is Microsoft Development language
②.php and jsp can rely on other servers such as apache or nginx
7. Briefly describe two methods of shielding notice warnings of PHP programs?
Answer: Initialize variables, set the error level at the beginning of the file or modify php.ini to set error_reportingset_error_handler and @Suppress errors:
①Add: error_reporting(E_ALL&~E_NOTICE);②.Or modify Change: error_reporting=E_ALL in php.ini to: error_reporting=E_ALL&~E_NOTICE③.error_reporting(0); or modify php.inidisplay_errors=Off
8. Which of the following options does not add john to users In the array?(B)
(A)$users='john';(B)array_add($users,'john');(C)array_push($users,'john') ;(D)$users||='john';
9. Write a function to extract the file extension from a standard URL as efficiently as possible?
Answer: For example, ://www.sina.com.cn/abc/de/fg.php?id=1 need to remove php or .php?
$url="//www.sina.com.cn/abc/de/fg.php?id=1"; arr=parseurl(url); pathArr=pathinfo(arr['path']); print_r($pathArr['extension']);
10. Write a function , can it traverse all files and subfolders under a folder?
Answer: As follows.
functionaGetAllFile($folder) { $aFileArr=array; if(is_dir($folder)) { handle=opendir(folder); while((file=readdir(handle))!==false) { //如果是.或者..则跳过 if(file=="."||file=="..") { continue; } if(is_file(folder."/".file)) { aFileArr=file; } elseif(is_dir(folder."/".file)) { aFileArr[file]=aGetAllFile(folder."/".file); } } closedir($handle); } return$aFileArr; } $path="/home/test/sql";
The above is the detailed content of 10 PHP interview questions commonly used in IT company interviews in spring 2019!. 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



Alipay PHP...

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,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

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.

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...
