1. What is PHP?
PHP (Hypertext Preprocessor) is a server-side scripting language used for web development. It is used to create dynamic and interactive web pages.
2. What are the advantages of PHP?
Open source, platform independent, easy to learn, large community support, and compatible with many databases.
3. What is the full form of PHP?
PHP stands for Hypertext Preprocessor.
4. What is a PHP file?
A PHP file contains PHP code and ends with the extension .php.
5. How do you write a PHP script?
PHP script starts with <?php and ends with ?>.
6. What is echo in PHP?
Echo is used to display output on the browser.
7. What is the difference between echo and print?
Echo can display multiple strings and is slightly faster. Print returns a value and displays only one string.
8. What are variables in PHP?
Variables are used to store data. In PHP variables start with $ sign.
9. What are PHP data types?
String, Integer, Float, Boolean, Array, Object, NULL, Resource.
10. What are constants in PHP?
Constants are values that cannot be changed during script execution.
11. What are operators?
Operators are symbols used to perform operations on variables and values.
12. Types of operators in PHP?
Arithmetic, Assignment, Comparison, Logical, Increment/Decrement, String, Array.
13. What is the use of == operator?
It checks equality of values.
14. What is === operator?
It checks both value and data type.
15. What is the concatenation operator?
The dot (.) operator is used to join two strings.
16. What is if statement?
It executes code if a condition is true.
17. What is if-else?
It executes one block if condition is true and another if false.
18. What is switch statement?
It is used to perform different actions based on different conditions.
19. What is loop in PHP?
Loops are used to execute a block of code repeatedly.
20. Types of loops in PHP?
for, while, do-while, foreach.
21. What is a function?
A function is a reusable block of code.
22. How to create a function?
Using the keyword function.
23. What is a parameter?
A parameter is a variable passed into a function.
24. What is return statement?
Return sends a value back from a function.
25. What are built-in functions?
Functions that are already defined in PHP.
26. What is an array?
An array stores multiple values in a single variable.
27. Types of arrays in PHP?
Indexed array, Associative array, Multidimensional array.
28. What is indexed array?
An array with numeric index.
29. What is associative array?
An array with named keys.
30. What is multidimensional array?
An array containing one or more arrays.
31. What is string?
A string is a sequence of characters.
32. strlen() function?
Returns length of a string.
33. strpos() function?
Finds position of first occurrence of a string.
34. substr() function?
Returns part of a string.
35. strtoupper() function?
Converts string to uppercase.
36. What is form handling?
Processing user input from HTML forms using PHP.
37. What is GET method?
GET sends data through URL.
38. What is POST method?
POST sends data through HTTP request body.
39. Which is more secure GET or POST?
POST is more secure than GET.
40. What is isset()?
Checks whether a variable is set.
41. What is session?
Session stores user data on the server.
42. What is cookie?
Cookie stores small data in user’s browser.
43. session_start()?
Starts a new session or resumes an existing session.
44. How to destroy session?
Using session_destroy().
45. How to create cookie?
Using setcookie() function.
46. What is file handling?
File handling allows reading and writing files.
47. fopen()?
Used to open a file.
48. fclose()?
Used to close a file.
49. fread()?
Reads file content.
50. fwrite()?
Writes content to a file.
51. What is MySQL?
MySQL is a relational database used with PHP.
52. mysqli_connect()?
Used to connect PHP with MySQL database.
53. What is CRUD?
Create, Read, Update, Delete operations.
54. What is PDO?
PHP Data Objects used for database access.
55. What is SQL injection?
A security vulnerability where attacker injects SQL code.
56. What is OOP?
Object Oriented Programming uses objects and classes.
57. What is class?
A blueprint for creating objects.
58. What is object?
Instance of a class.
59. What is inheritance?
A class can inherit properties of another class.
60. What is encapsulation?
Binding data and methods together.
61. What is polymorphism?
Ability of object to take many forms.
62. What is constructor?
Special function automatically called when object is created.
63. What is destructor?
Called when object is destroyed.
64. What is namespace?
Used to avoid name conflicts.
65. What is trait?
Trait allows code reuse in PHP.
66. What is AJAX?
Technique to update web page without reloading.
67. What is JSON?
JavaScript Object Notation used for data exchange.
68. json_encode()?
Converts PHP array to JSON.
69. json_decode()?
Converts JSON to PHP object.
70. What is MVC?
Model View Controller architecture.
71. What is XSS?
Cross Site Scripting attack.
72. What is CSRF?
Cross Site Request Forgery attack.
73. password_hash()?
Used to hash passwords.
74. password_verify()?
Verifies hashed password.
75. htmlspecialchars()?
Prevents XSS attack.
76. What is include?
Includes file into another file.
77. What is require?
Similar to include but stops execution if file not found.
78. What is include_once?
Includes file only once.
79. What is require_once?
Requires file only once.
80. What is superglobal?
Predefined variables accessible everywhere.
81. Examples of superglobals?
$_GET, $_POST, $_SESSION, $_COOKIE.
82. What is $_SERVER?
Contains server information.
83. What is $_REQUEST?
Contains GET, POST and COOKIE data.
84. What is $_FILES?
Used for file upload.
85. What is $_ENV?
Contains environment variables.
86. What is error_reporting()?
Sets error reporting level.
87. What is die()?
Stops script execution.
88. What is exit()?
Terminates script execution.
89. What is header()?
Sends raw HTTP headers.
90. What is redirect?
Sending user to another page.
91. What is composer?
Dependency manager for PHP.
92. What is Laravel?
Popular PHP framework.
93. What is CodeIgniter?
Lightweight PHP framework.
94. What is REST API?
Web service for communication between applications.
95. What is API?
Application Programming Interface.
96. What is caching?
Storing data temporarily to improve performance.
97. What is pagination?
Dividing data into multiple pages.
98. What is debugging?
Finding and fixing errors.
99. What is PHP version currently used widely?
PHP 8.x versions are widely used.
100. Why is PHP popular?
Easy to learn, powerful, and widely used for web development.
📢 Join Our WhatsApp Channel
💼 Get Daily IT Job Updates, Interview Preparation Tips & Instant Alerts directly on WhatsApp.
👉 Join WhatsApp Now📢 Join Our Telegram Channel
💼 Get Daily IT Job Updates, Interview Tips & Exclusive Alerts directly on Telegram!
👉 Join Telegram