Top 50 PHP Interview Questions and Answers

PHP Interview Questions and Answers

Some PHP interview questions and answers-

Question 1. Who is the father of PHP language?

Answer : Programmer Rasmus Lerdorf is the father of PHP (general-purpose scripting) language.

Question 2. What is the full form of PHP originally stand for?

Answer : PHP stands for Personal Home Page, but it now stands for Hypertext Preprocessor.
It is general-purpose scripting language.

Question 3. Is PHP a case sensitive language?

Answer : PHP is Not fully case sensitive language. It is partly a case sensitive language. But variable names are case-sensitive.

Question 4. What are the most popular frameworks in PHP?

Answer : Some PHP frameworks are given bellow –

  • CakePHP, CodeIgniter (CI), Zend Framework and Symfony.

Question 5. What are most popular Content Management Systems (CMS) in PHP?

Answer : WordPress(WP), Magneto, Drupal and Joomla.

Question 6. What is NULL in PHP?

Answer : NULL is a particular type of value in PHP. It represents a variable with no value and is usually used to denote the absence of a deal.

Question 7. What is the null function in PHP?

Answer : In PHP, is_null() function checks whether a variable is NULL or not. if the variable is NULL then this function returns true (1) and if the variable is not NULL then it returns nothing/false.

Example –

<?php
$a = 0;
$b = NULL
is_null($a); // it returns nothing/false
is_null($b); // it returns 1
?>

Question 8. What are the differences between PHP variables & constants?

Answer :

  • PHP constants and variables differences in their scope.
  • PHP constants are global, means they are accessible in whole an application, while variables are only accessible in the area where they were defined.
  • PHP constants must be explicitly defined before they can be used, while variables can be used without initializing.

Question 9. How many types of variables in PHP?

Answer : PHP has three different variable in scopes: local, global & static.

Question 10. How many Data Types in PHP?

Answer : There are 8 data types variables used in PHP –

  • Integers, Doubles (floating-point numbers), Boolean’s, Strings, NULL, Arrays, Objects and Resources.

Question 11. What is the default time of PHP session?

Answer : The default session time is until the closing of the browser in PHP.

Question 12. What is the default time limit of PHP script execution?

Answer : The default limit is 30 seconds of PHP script execution.

Question 13. How will you check whether a variable is set in PHP?

Answer: In PHP, the PHP function ISSET checks if a variable is set.

Question 14. What is the main difference between the strstr() and stristr() function in PHP?

Answer: This main difference between the strstr() and stristr() function is strstr() is not case-sensitive but stristr() is case-sensitive.

Question 15. What is the name of file of PHP configuration settings?

Answer: The “php.ini” is the configuration settings file of PHP

Question 16. How do you define a PHP constant?

Answer: A PHP constant is defined given as bellow-

define (“ACONSTANT_NAME”, 400).

Question 17. What is the function used to remove the HTML tags from data?

Answer: The strip_tags() function is used to remove HTML tags from data.

Question 18. What is the latest PHP version?

Answer: The latest version of PHP is 8.3.

Top 50 PHP Interview Questions and Answers

2 Comments

  1. rakesd

    Good Sir, Important Interview qes and ans for fresher.

Leave a Reply

Your email address will not be published. Required fields are marked *