The 11 most frequently asked questions and answers in PHP

Source: Internet
Author: User
This article mainly introduces the 11 most frequently asked questions and answers in PHP. each company has its own interview standards. interviews and questions depend entirely on your role in your work, of course, it is also closely related to your programming skills. if you need a friend, can you refer to whether you are looking for a job in PHP development and looking for some questions and answers about PHP? This article will share with you some of the 11 most frequently asked PHP interview questions and the corresponding regular answers. each company has its own interview standards, interviews and questions depend entirely on the roles you play at work, and are also closely related to your programming skills.

Q: What is PHP in the simplest language?

A: PHP is short for Hypertext Preprocessor. it is a server scripting language used to develop dynamic websites.

Question: What is MVC?

A: MVC is composed of Model, View, and Controller. php mvc can manage PHP code on three different layers more efficiently.

Model: data information access layer.
View: The view layer displays application data in a specific way on the interface.
Controller: Generally, the Controller reads data from the view, controls user input, and sends data to the model.

Q: How can I reference CSS on a page?

A: There are three ways to use CSS on the page:
Reference external CSS files
Internally define Style styles
Inline style

Q: Does PHP support multi-inheritance?

A: No. The PHP class can inherit only one parent class and is identified by the keyword "extended.

Q: What is the difference between echo and print in PHP?

These two seem very similar, because they all print some values on the screen. However, the essential difference between echo and print is that echo is used to output strings. when multiple values are displayed, they can be separated by commas. Only basic types are supported. print not only prints string values, but also prints the return values of functions.

Q: What is the difference between GET and POST methods?

A: The form information we enter on the web page can be transmitted to the server using these two methods. when we use the GET method, all the information will appear in the URL address, in addition, the GET method can only pass a maximum of 1024 characters, so you can use the GET method if the transmission volume is small or the security is not so important. The POST method can transmit up to 2 MB of data and can be adjusted as needed.

Q: How does PHP obtain the image size?

Answer: getimagesize () obtains the image size.
Imagesx () to get the image width
Imagesy () to get the image height

Q: What is PEAR in PHP?

A: PEAR is the PHP Extension and Application library (PHP Extension and Application Repository). It is a code Repository for PHP Extension and Application.

Q: How can I use PHP and MySQL to upload videos?

A: We can store video addresses in the database without having to store real video data in the database. You can store the video data in a specified folder on the server. the default size of the video to be uploaded is 2 MB, but you can also modify the max_file size option in the php. ini file.

Q: What are the error types in PHP?

A: PHP has three types of errors.

Tip: these are some very normal information, not major errors, and some will not even be displayed to users. For example, access to a variable that does not exist.
Warning: this is a serious error. the warning information will be displayed to the user, but it will not affect the code output, such as containing some files that do not exist.
Error: this is a real serious error, such as accessing a PHP class that does not exist.

Q: How do I define constants in PHP?

A: Use Define () in PHP to Define constants.

The code is as follows:


Define ("Newconstant", 30 );

Q: How do I not use the submit button to submit a form?

If we do not want to use the submit button to submit a form, we can also use a hyperlink to submit the form. we can write code like this:

The code is as follows:


Submit Me

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.