PHP Interview Questions and Answers

1. What is the name of the Script Engine in PHP?

Zend Engine 2

2. What are the uses of count() function in PHP?

This function is used in counting all the elements in the array.

3. How can we include the file to the PHP page?

We could include the file to the PHP page using a require() or include() function with the file path as their parameter.

4. What are the Data Types in PHP?
  • Under Compound types
    • Array
    • Object
    • Callable
  • Under Scalar types
    • Float
    •  String
    • Integer
    • Boolean
  • Under Special types
    • Null
    • Resource
5. Mention the frameworks in PHP?
  • Yii 2
  • Symfony
  • CakePHP
  • CodeIgniter
  • Zend Framework
6. How do you stop the execution of the PHP Script?

By using Exit(); function.

7. What are the Consonants in PHP?


8. What are the uses of PHP?
  1. It can gather the data from files, save those data to a file and also we can send those data through email.
  2. One could delete, add, and modify elements within the database by using PHP.
  3. We can access the cookies variables.
9. Define PHP 5?

This is a Server Script language. It is used in making dynamic and interactive web pages. Besides, it is a free and useful alternative for its competitor like Microsoft’s ASP.

10. What are the Magic Functions that are available in the PHP?

_destruct() _call() _get() _set() _isset() _unset() _construct() _sleep() _clone() _invoke() _to string _wakeup() _set-state() _debuginfo()

11. How do you stop executing a PHP Script?

exit(); function.

12. What is the session time of PHP?

It will last for 24 minutes(1440 seconds).

13. Mention the uses of PHP and MySQL?

PHP: It is the scripting language and used in Web Development.

MySQL: MySQl is a Relational Database Management System.

14. Name the variable’s scope in PHP?
  • Local Scope
  • Global Scope
  • Static Scope
15. How would you redirect the page in PHP?

header(“Location:HomePage.php”); These are the Basic PHP and MySQL Interview Questions that are asked to a fresher and Experienced candidate in an Interview.

16. What is the one main distinction between PHP4 and PHP5

PHP5 can present various additional Object-Oriented Programming (OOP) features compared to PHP4.

17. Which method is used in sending the Simple Mail Transfer Protocol using PHP?

mail($EmailAddress, “Subject”, $MessageBody);.

18. What are the types of Array in PHP?
  • Indexed Array
  • Associative Array
  • Multi-Dimensional Array
19. What are the features of PHP7?
  • Spaceship operator
  • Generator delegation
  • Anonymous classes
  • Closure:: call method
  • Group use declaration
  • Scalar type declarations
  • Return type declarations
  • Null coalescing operator (??)
  • Constant arrays using define()
  • Generator return expressions.
20. List the Content Management Systems in PHP?
  1. WordPress
  2. Joomla
  3. Magento
  4. Drupal
21. How many columns we can create for the index?

For a Standard Table, we can create 16 indexed columns.

22. From the below cURL which of them is not a valid parameter PHP?


23. Which one is not a valid method in PHP XML DOM?

geElementById() is not a valid method in the PHP XML DOM.

24. What is the role of a LAMP in PHP?

It is the combination of Linux, Apache, PHP, and MySQL.

25. What is the meaning of Self in PHP?

It is the Self keyword that is used in accessing the static methods and properties.

26. What is the Scope level in PHP?
  • Private
  • Public
  • Protected
27. What are the various types of operators available in PHP?
  • Union
  • Union All
  • Minus
  • Intersect
28. List the encryption functions that are available in PHP?
  • crypt()
  • Mcrypt()
  • hash()
29. Explain Composer in PHP?

It is the package manager for the application level in PHP. Composer permits you to declare libraries depending on the project and also they will allow you to update.

30. What are the various types of print functions that are available in PHP?

print() Function
printf() Function
echo() Function
print_r() Function
sprintf() Function

30. Differentiate between PHP and Java
Criterion PHP Java
Deployment area Server-Side Scripting language General Purpose Programming language
Supports Rich APIs No Yes
Language Type Dynamically typed Statically typed.
31. Elucidate polymorphism in PHP?

It describe patterns in object oriented programming. Where the classes have multiple functionality when sharing the common interface.

32. Mention the use of die in PHP?

This function prints the message, exists in the current script.

About the author

Santhakumar Raja

Hi, This blog is dedicated to students to stay update in the education industry. Motivates students to become better readers and writers.

View all posts

Leave a Reply