PHP Interview Questions

You might be writing code for a long time but when it comes to the theory you feel stuck?
Then you have come to the right place. Let’s learn top PHP questions asked in the interview and crack the theory part. You are already good at programming part. Yes, you are every programmer is. Let’s crack it now.

Not interested in Interview Question? Try hands-on programming

PHP is a scripting language that is mainly used to create dynamic web pages. PHP code can be embedded to HTML to create a dynamic web page. PHP originally stood for Personal Home Page, but it now stands for the recursive acronym PHP: Hypertext Preprocessor.

PEAR stands for “PHP Extension and Application Repository”. A structured library of open-source code for PHP users. It is a framework for reusable PHP components.

Latest version of PHP : 7.1

Latest version of PHP : 7.1

Yes it is possible just open command line interface and use

php <>
Make sure to include php in environment variable

Require and include both functions are used for including an external file but in case of require if we do not include the file it will give fatal error and stop the execution of programme however include will not give the fatal error and and do not stop the execution of program.

require(), and require_once() both are used to include other php file. require _once function check if the file is already included if it is included it will not include that again

We can define a function set_time_limit(int $seconds ) to limit the maximum execution time.The default limit is 30 sec.max_execution_time value defined in the php.ini.





unset() function will make a variable undefined.
unlink() function is used in file handling system and it deletes the file.

strip_tags() is used to remove HTML tags

Session data is stored on server and cookied data is stored on user computer

session_start() functions used to start session in php

$GLOBALS we can use to get all variables defined in global scope

Session data is stored on server and cookie data is stored on user computer

$_FILES is an associative array composed of items sent to the current script via the HTTP POST method.

Default size to upload an image is 2MB. It is possible to change the max upload size by editing php.ini file upload_max_filesize

== check just value === check value as well as datatype

  1. Notices (non-critical)
  2. Warnings (serious)
  3. Fatal errors (critical). -> Stops the execution of programme

Session data is stored on server and cookie data is stored on user computer

  1. Sessions
  2. Cookies
  3. Hidden form fields.
  4. GET or POST

echo “Hello World” . “\n”


Make sure any characters that are special in html are properly encoded so people can’t inject HTML tags or Javascript into your page.