Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

2018 PHP Interview Questions Picks Do you dare to challenge?


May 11, 2021 PHP



This article for you to organize a number of 2018 questions more frequently PHP interview questions, as well as the corresponding answers, look forward to the PHP industry elite to come to challenge.


2018 PHP Interview Questions Picks Do you dare to challenge?


1: Tell me what PHP is in simple language?

A: PHP full name: Hypertext Preprocessor is a server scripting language used to develop dynamic websites.


2: What is MVC?

A: MVC consists of three parts, Model( Model), View (View), and Controller (Controller), which allows you to manage three different layers of PHP code more efficiently with PHP MVC.

Model: Data information access layer.

The View:View layer is responsible for presenting the applied data to the interface in a specific way.

Controller: Typically, the controller is responsible for reading data from the view, controlling user input, and sending data to the model.


3: How many ways to reference CSS on a page?

There are generally three more ways:

1) Inline style

Inline styles are css styles that define the label directly on html labels, such as:

<div style="width:100px;height:100px;"></div>

2) Internal style

The internal style is written in the html file and is included in the code block of the style, which is written in the head as follows:

<style>
div{width:100px;height:1000px;}
</style>
<div></div>

3) External style

External styles control styles by referencing external css files in html, such as:

Write a reference statement in the html file:

<link href="css文件路径" rel="stylesheet" media="screen" />


4: Does PHP support multi-inheritance?

A: No. T he PHP class inherits only one parent class and is identified by the keyword "extended".


5: What's the difference between echo and print in PHP?

A: Both features print some values on the screen. T he difference between the two is that echo is used to output strings, can be separated by commas when displaying multiple values, and only supports basic types. P rint can print not only string values, but also the return values of functions.


6: What's the difference between GET and POST methods?

A: The form information we fill out on the web page can be passed to the server by both methods, and when using the GET method, only 1024 characters can be passed, and all the information will appear on the URL. So you can use the GET method if the amount of transmission is small or if the security requirements are low.

The POST method, the specific value of transmission can be freely adjusted, but not more than 2MB at most.


7: What is the method for getting image size in PHP?

For:

getimagesize() to get the size of the picture

Imagesx() gets the width of the picture

Imagesy() gets the height of the picture


8: What is THE in PHP?

A: PEAR is the PHP Extension and Application Repository, which is a code repository for PHP extensions and applications.


9: How do I upload videos with PHP and MySQL?

A: We can put the video address in the database, and we don't have to store the real video data in the database. V ideo data can be stored under the server's specified folder, the default upload size is 2MB, but we can also modify the max_file size option in the php.ini file to change this value.


10: What are the types of errors in PHP?

A: There are approximately three types of errors encountered in PHP.

1. Tip: This is basically some normal information rather than errors, some will not even show to the user. F or example, access to variables that do not exist.

2. Warning: This type of general error will show the user the warning message, but will not affect the output of the code, such as containing some files that do not exist.

3. Error: This is a serious error that affects the operation of the entire code, such as accessing a PHP class that does not exist.


11: How do I define a constant in PHP?

A: In PHP, you can use Define() to define constants, as follows:

define(“Newconstant”, 30)


12: How do I submit a form without using the submit button?

A: In addition to submitting forms with the submit button, you can also submit forms with hyperlinks, which can be implemented using the following code:

<a href=”javascript: document.myform.submit();”> Submit Me</a>

Related reading:

PHP micro-class - theory of real combat a grasp

PHP Getting Started tutorial