PHP Interview Questions

PHP Interview Questions | Freshers & Experienced

  • Ketan Chauhan
  • 05th Nov, 2019
  • 961 Followers

PHP Interview Questions

Q1. What is mvc in PHP?

MVC is a design pattern for creating applications that separate Business logic (Controller) and Application data (Models) from the USER interface (View). MVC is an acronym of Model, View Controller.

Q2. Write a program to upload files using curl

Q3. What is name of max execution time constant in php?

max_execution_time is of the constant that is used to increase the execution time of a script in PHP.

Q4. What is difference between echo and print in PHP?

 There are small difference between Echo and Print in PHP. 

 These are - 

  1. Echo has no return value while Print has a return value of 1.
  2. Echo is marginally faster in comparison of Print.
  3. Echo can output one are more strings while Print can output only 1 string.
  4. Echo is a language constructor while Print is a function.

Q5. What is HTML DOM?

DOM (Document Object Model) is a Object Model for HTML. The Document Object Model (DOM) defines the logical structure of documents and the way a document is accessed and manipulated.

Q6. How to create cookies via Ajax in PHP?

Q7. What is sql injection? What you do to prevent SQL Injection in PHP?

Q8. Explain scope levels in PHP.

There are 3 different levels of Scopes are available in PHP. They are.

  • Public: Public scopes allow you to access all data and functions of a Class.
  • Private: Private scopes don't allow you to access the private data and functions of a Class.
  • Protected: Protected scopes only allows its derived class to access the Protected data and functions of a Class.

Q9. Find the longest palindrome in a string

Q10. What is difference between session and cookie?

The Major difference between sessions and cookies are - 

  1.  Sessions are stored in Server Side while Cookies are sotred in Client Side.
  2.  Sessions are stored unlimited amount of Data while Cookies are Stored limited amount of Data.
  3.  Sessions are holding multiple variables while Cookies are not holding multiple varibles.
  4.  Sessions are more secure than Cookies.
  5.  Sessions values are not easily accessible While Cookies values are easily accessible.
  6.  Sessions can not disabled by visitor while cookies can disabled by the visitor.

Q11. How to get IP address of user in PHP

In your code simply use  $_SERVER['REMOTE_ADDR'] to get the IP address of the client or User.

Q12. What is the full form of PHP?

The full form of PHP is Hypertext preprocessor (earlier called personal home page)

Q13. How to create object of Interface?

Q14. What is cross site scripting and how it can be prevented?

Q15. Write pyramid structure without using PHP function ?

Q16. What is difference between XAMPP, WAMP, and LAMP

Q17. Tell me few diffrence between GET & POST

Few difference between GET & POST is - 

GET request remains in browser history while POST Request does not remain in browser history.

GET is availbale for retrieving data while POST is available for writing/Updating data.

GET have no side effects while POST have some side effects.

 

Q18. How to connect MongoDB using PHP?

Q19. What is default session time in PHP? How to increase It?

Q20. How can you connect a web page data with mysql ?

Q21. Explian the difference between preg_Match and preg_replace?

preg_Match is the pattern, that is used for searching as a string, while preg_replace is the pattern, that contains the string which is used to search the content, which can be the array of string.

 

Q22. List the HTTP methods avalable in PHP?

Q23. What is Interface? Why we use it?

Q24. What is difference between PHP 4, 5 and 7?

Q25. What is difference between the include(), require(),require_once() functions in PHP?

Q26. What are design patterns in PHP? Can you list few.

Q27. What are Super Global variables in PHP?

Q28. What is Php ini?

Q29. Code to send a mail with attachment using phpmailer?

Q30. What is difference between CURL and AJAX?

Q31. How to set and Get a value in PHP Session.

Q32. What is the usage of link() in PHP?

PHP link() function is used to hard link for a specified target. The link function takes two arguments first is the target file and the second argument is the name of the link.

Note: The link() function does not work remotely.

Example

<?php
$target = "abc.php";
$linkname = "name of link";
link($target, $linkname);
?>

Q33. PHP resembles syntax from which programming Lanaguage?

PHP resembles its syntax from C and Perl Programming Language.

Q34. What is the default session path in PHP?

The default PHP session storage path on the server is /tmp directory.

About Author :

  • Author of PHP Interview Questions

    Ketan Chauhan

    Ketan is a Software developer from Bengaluru, Karnataka, India.He works on latest Javascript technologoies like Angular, Node JS, React JS. He has also good knowledge of PHP and its frameworks like CodeIgniter, CakePHP,Laravel, Zend.He is always ready for learning new technologies. He loves playing Table tennis, watching and answersing developers queries.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Explore Popular Courses on Php

Start working with Landrick that can provide everything you need to generate awareness, drive traffic, connect.

Laravel for beginners v6
  •  3.9 Star (10)
  • Udemy