PHP Interview Questions & Answers

Showing 10 of 109 questions | Page 7

PHP technical interview questions and answers are essential for candidates preparing for web development roles. PHP powers millions of websites and content management systems, so companies often evaluate your knowledge of syntax, arrays, sessions, cookies, form handling, OOP concepts, and database connectivity. Popular companies like TCS, Wipro, Infosys, Capgemini, Cognizant, and Accenture regularly include PHP questions in coding rounds and technical interviews. This guide explains the most frequently asked PHP interview questions with simple examples and clear definitions. Whether you are a fresher preparing for campus placements or an experienced developer, these questions will help you understand PHP concepts better. You can also download PHP interview PDFs and practice mock questions for better preparation.

Web developers should complement their PHP skills with MySQL database  knowledge and JavaScript programming for full-stack development 

Showing 10 of 109 questions

61. What are the functions for IMAP?

imap_body Read the message body imap_check Check current mailbox imap_delete Mark a message for deletion from current mailbox imap_mail Send an email message

62. What are encryption functions in PHP?

CRYPT() MD5()

63. What is the difference between htmlentities() and htmlspecialchars()?

htmlspecialchars() Convert some special characters to HTML entities (Only the most widely used) htmlentities() Convert ALL special characters to HTML entities

64. What is the functionality of the function htmlentities?

htmlentities() Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

65. How can we get the properties (size, type, width, height) of an image using php image functions?

To know the image size use getimagesize() function To know the image width use imagesx() function To know the image height use imagesy() function

66. How to reset/destroy a cookie

Reset a cookie by specifying expire time in the past: Example: setcookie(Test,$i,time()-3600); // already expired time Reset a cookie by specifying its name only Example: setcookie(Test);

67. How many ways can we get the value of current session id?

session_id() returns the session id for the current session.

68. How can we destroy the cookie?

Set the cookie with a past expiration time.

69. What are the current versions of Apache, PHP, and MySQL?

PHP: PHP 5.1.2 MySQL: MySQL 5.1 Apache: Apache 2.1

70. What are the reasons for selecting LAMP (Linux, Apache, MySQL, Php) instead of combination of other software programs, servers and operating systems?

All of those are open source resource. Security of linux is very very more than windows. Apache is a better server that IIS both in functionality and security. Mysql is world most popular open source database. Php is more faster that asp or any other scripting language.
Questions and Answers for Competitive Exams Various Entrance Test