PHP Interview Questions and Answers
1
Tell something about PHP.
PHP stands for: Hypertext Preprocessor. PHP is a server side scripting language which is used to develop the dynamic websites.
2
What is MVC?
MVC stands for Model, View, and Controller. PHP MVC is an effective way to manage the code into 3 different layers.
Model: Model represents the information in application.
View: View represents the visual representation of information and data that you have entered in the application.
Controller: Controller is actually how and in which way you want to read the information in application.
Model: Model represents the information in application.
View: View represents the visual representation of information and data that you have entered in the application.
Controller: Controller is actually how and in which way you want to read the information in application.
3
What are the different types of CSS you can add in a page?
There are three types of CSS that can be added in a page.
- External CSS.
- Internal CSS.
- Inline CSS.
4
Does PHP support multiple inheritances?
No, PHP support only single level of inheritance. A class can be inherited from a single class using keyword ‘extended’.
5
What is the difference between echo and print?
Initially both look same because both used to display any value. Main difference between echo and print is that echo is just used to display any string in output. It will display whatever is passed to it but on other hand print is a function itself it not only display any value but also can return value.
6
What is the difference between GET and POST method?
Whenever we fill any form on internet we can used one from two methods to send data on sever computer, that method can be either GET or POST. When we use the GET method all information is displayed on address bar. If can sent up to 1024 of data using GET method so it is good to use only when we are working with small scale applications and data is not that much sensitive. If we talk about POST method, No information will be displayed on address bar and we can send up to 2 mb of data using POST method. This limit can also extend further if required. PHP includes many CMS systems which can be used to handle the web content in a effective way.
7
What functions are used to get the image size, Width and Height?
getimagesize () to get the size of an image
Imagesx () to get width of an image
Imagesy () to get height of an image.
Imagesx () to get width of an image
Imagesy () to get height of an image.
8
What is PEAR in PHP?
PEAR stands for “PHP Extension and Application Repository”. PEAR provides an inbuilt library of open source code for PHP developers. It provides support for package maintains and code distribution.
9
How do you upload videos using PHP & MySQL?
We just need to copy the path of stored videos in the database rather than storing the videos files itself. All videos will be saved on a different folder and videos can be called from that folder when ever required. Default size is 2 mb for video files but we can change that size from max_file size option in php.ini file.
10
What are the different types of errors in PHP?
There are three types of errors encountered in PHP.
- Notice: These are very normal and non-critical errors and they even not displayed to users. For examples accessing a variable that not existed at all.
- Warning: These are little bit critical errors. These results are displayed to users but do not affect the output of code. For example trying to include any file that is not exists.
- Fatal errors: These are really critical errors. For example calling any non existence class.
0 komentar:
Posting Komentar