Top 20 PHP Interview Questions and Answers

Home » Lists » Top 20 PHP Interview Questions and Answers

Below are the most frequently asked questions in a PHP Interview and their expected answers are as follows:

1. What is ‘PHP’?

PHP is a kind of web language on scripts which allow the developers to create webpages.

2. What is the full form of PHP?

The term PHP means “PHP: Hypertext Preprocessor”.

3. PHP resembles to which other programming language?

PHP resembles to C and Perl

4. The term PEAR stands for?

The term PEAR stand for ‘PHP- Extension and Application Repository’, its function is to extend PHP and give better programming to the developers.

5. What’s the used version of PHP?

‘Version 5’ is the used PHP version.

6. How can PHP script be executed from command line?

The PHP- command line has to be used and the file- name has to be specified for the script which will be executed.

7. How can PHP shell be run from command interface?

All that is required to be done is to use PHP program along with –a

8. What are those two correct and common ways to begin and end ‘PHP block of code’?

The two correct and general ways to begin and end a PHP scrip are as follows: php [ – PHP code—-] ?> and

9. How to show the output directly?

To show the output directly, special tags have to be used <? = and?>

10. What’s the difference in ‘PHP 5 and PHP 4’?

PHP 5 has an additional ‘(Object Oriented Programming)’ feature

11. Does PHP support multiple inheritances?

PHP has just one inheritance which says that a class may be extended by only one class by applying the keyword ‘extended’.

12. What does final method and final class mean?

The term final has been added in PHP 5. Final method means that it cannot be overridden and final class explains that the class cannot extend any further.

13. In what way is the comparison done away with in PHP5?

The operator ‘==’ is used to test the object and are said to have the same equal value and same attributes. A test can be conducted if two objects have same class and can be found out by identity operator ‘===’

14. How does HTML and PHP interact?

HTML can be generated by PHP scripts, information can be passed to PHP from HTML

15. What kind of function is required when the values are passed through form or URL?

If a value needs to be passed through URL or a form then the values has to be encodes and decoded by using urlencode () and htmlspecialchars ()

16. What is required to make it possible to utilize image function?

GD library is required to make it possible to use image function

17. What’s the utilization of ‘imagetypes’?

It gives the types and image format needed by the latest version of PHP

18. What functions are required to be utilized to get the properties of image (width, height and site)?

The functions are imagesx () width, imagesy () height and getimagesize () size

19. How can the information be displayed of a readable and variable by a human in PHP?

To display readable result print_r () has to be used

20. What is meant by ‘PHP error Parse error – unexpected T_ variable at line x’?

The PHP error says that a problem has occurred in line x and has stopped executing and parsing the program.

The following two tabs change content below.
Jamie Irwin

Jamie Irwin

Business Development Manager at Techlitic
Hi, I’m the Webmaster of Techlitic. I love all things Technological and Entrepreneurial. I'm from Northern Ireland and graduated with BSc in Business & Management, University of St Andrews. I'm dedicated to providing up-to-date news in the world of technology and webmaster aimed resources. When I'm not obsessing over web development.. I'm taking long walks on the beach with my dog, Coco, and keeping current with the world of Digital Marketing.
Author: Jamie Irwin
Tags