Are you looking for a job in PHP development and looking for some questions and answers about PHP? This article has shared some of the most frequently asked 11 PHP interview questions, as well as the corresponding regular answers, each company has its own interview criteria, the interview and the problem is entirely dependent on your role in the work, of course, and your programming skills are closely related.
1. Question: Please tell me in the simplest language what is PHP?
Answer: PHP full name: Hypertext preprocessor, is a server scripting language used to develop dynamic Web sites.
2. Question: What is MVC?
Answer: MVC consists of model (model), view (view) and controller (Controller), PHP MVC can manage 3 different layers of PHP code more efficiently.
Model: Data information access layer.
The View:view layer is responsible for presenting the applied data to the interface in a specific way.
Controller: Usually the controller is responsible for reading data from the view, controlling user input, and sending data to the model.
3. Question: Are there several ways to refer to CSS in a page?
Answer: There are 3 ways to use CSS in a page:
Referencing an external CSS file
Internal definition style Style
4. Question: Does PHP support multiple inheritance?
Answer: No, you can't. A PHP class can inherit only one parent class and is identified by the keyword "extended".
5. Question: What is the difference between echo and print in PHP?
These two look very similar, because they are all printing some values on the screen. But the essential difference between echo and print is that echo is used to output strings that can be separated by commas when displaying multiple values. Only basic types are supported, print can not only print string values, but also print the return values of functions.
6. Question: What is the difference between get and post methods?
Answer: The form information that we fill out on the Web page can pass the data to the server in both ways, when we use the Get method, all the information will appear in the URL address, and the Get method can only pass 1024 characters. So you can use the Get method if the traffic is small or the security is less important. When it comes to the post method, you can transfer up to 2MB bytes of data, and can be adjusted to suit your needs.
7. Question: What is the way to get image size in PHP?
Answer: getimagesize () Get the size of the picture
Imagesx () Get the width of the picture
Imagesy () Gets the height of the picture
8. Question: What is pear in PHP?
Answer: Pear is the PHP extension and application Library (PHP Extension and Application Repository), which is a PHP extension and application of a code warehouse.
9. Question: How do I upload video with PHP and MySQL?
Answer: We can store the video address in the database without having to put the real video data in the database. The video data can be stored in the server's designated folder, the default size of the upload is 2MB, but we can also modify the max_file size option in the php.ini file to change.
10. Question: What are the types of errors in PHP?
Answer: There are roughly 3 types of errors encountered in PHP.
Hint: This is some very normal information, not a major error, some will not even show to the user. such as accessing a variable that does not exist.
Warning: This is a somewhat serious error that will present the warning message to the user, but will not affect the output of the code, such as containing some files that do not exist.
Error: This is really a serious error, such as accessing a nonexistent PHP class.
11. Question: How do I define Constants in PHP?
Answer: PHP uses define () to define constants.
Define ("Newconstant", 30);
Question: How do I submit a form without using the Submit button?
If we don't want to submit the form with the Submit button, we can also submit it with a hyperlink, and we can write the code like this:
Above these 11 is the most basic PHP common sense, here record, also gives the new introductory phper the reference