Are you looking for a PHP development job, and are you looking for some questions and answers about PHP? This article shares some of the 11 most frequently asked PHP interview questions, as well as the corresponding regular answers, each company has its own interview criteria, interviews and questions are entirely dependent on your role in the work, of course, and your programming skills are closely related.
Question: Please tell me in the simplest language what PHP is?
Answer: PHP full name: Hypertext preprocessor, is a server scripting language used to develop dynamic Web sites.
Question: What is MVC?
Answer: MVC consists of model, view, and controller, and PHP MVC can manage 3 different layers of PHP code more effectively.
Model: Data information access layer.
View: The view layer is responsible for presenting the applied data to the interface in a specific way.
Controller: It is common for controllers to read data from the view, control user input, and send data to the model.
Question: Are there several ways to reference CSS in a page?
Answer: There are 3 ways to use CSS in the page:
- referencing external CSS files
- Internally defined style style
- inline style
Question: Does PHP support multiple inheritance?
Answer: No, you can't. The PHP class can inherit only one parent class and is identified with the keyword "extended".
Question: What is the difference between echo and print in PHP?
These two look very similar, because they all print some values on the screen. But the essential difference between echo and print is that echo is used to output strings, which can be separated by commas when displaying multiple values. Only basic types are supported, and print can print not only string values, but also the return values of the functions.
Question: What is the difference between the Get and post methods?
Answer: The form information that we fill out on the webpage can pass the data to the server through these two methods, when we use Get method is, all information will appear in the URL address, and use Get method can only pass 1024 characters, Therefore, you can use the Get method if the transfer volume 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 adjust it as needed.
Question: What is the way to get the size of an image in PHP?
Answer: getimagesize () Get the size of the picture
Imagesx () Get the width of the picture
Imagesy () Get the height of the picture
Question: What is pear in PHP?
Answer: Pear is the PHP extension and application Library (PHP Extension and Application Repository), which is a code repository for PHP extensions and applications.
Question: How do I upload videos in PHP and MySQL?
Answer: We can store the address of the video in the database without having to have the real video data in the database. The video data can be stored in the server's specified 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.
Question: What are the types of errors in PHP?
Answer: There are roughly 3 types of errors encountered in PHP.
Tip : It's all very normal information, not a big mistake, and some won't even show it to the user. For example, access to non-existent variables.
warning : This is a bit of a 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 a real serious error, such as accessing a nonexistent PHP class.
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 do not want to submit the form with the Submit button, we can also use hyperlinks to submit, we can write the code:
<a href= "Javascript:document.myform.submit (); >submit me</a>
Original: Top PHP Job interview Questions and Answers for 2014 translations: codeceo– Xiao Feng
11 most frequently asked PHP face questions