Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

PHP Interview Questions and Answers for Freshers 2018

Author: Venkatesan Murugan
by Venkatesan Murugan
Posted: Sep 13, 2018

Q1. What is PHP?

PHP is server side scripting language. It is the most widely used web technology to create dynamic web pages. There are many PHP based frameworks and Open sources available for free to use. Some examples include WordPress, Drupal, Laravel etc. We can embed PHP with HTML and can further write server-side code with PHP for web development.

Q2. Which is the latest version of PHP?

Stable release?:?7.1.4 / 13 Apr 2017; http://php.net/downloads.php

Q3. What are the extensions of PHP File?

.php,.phtml,.php3,.php4,.php5,.php7,.phps.

Q4. What is the difference between include(), include_once() and require_once()

The include() statement includes and evaluates a specified line i.e. it will include a file based in the given path. require() does the same thing expect upon failure it will generate a fatal error and halt the script whereas include() will just gives a warning and allow script to continue. require_once() will check if the file already has been included and if so it will not include the file again.

Q5. Differences between GET, POST and REQUEST methods?

GET and POST are used to send information from client browser to web server. In case of GET the information is send via GET method in name/value pair and is URL encoded. The default GET has a limit of 512 characters. The POST method transfers the information via HTTP Headers. The POST method does not have any restriction in data size to be sent. POST is used for sending data securely and ASCII and binary type’s data. The $_REQUEST contains the content of both $_GET, $_POST and $_COOKIE.

Q6. Explain how PHP sends output to Browser? OR How a file is processed when it sends output to browser?

  1. Open website http://www.tutorialmines.net
  2. Request send to server of http://www.tutorialmines.net
  3. Call PHP Files.
  4. PHP Scripts are loaded into memory and compiled into Zend opcode.
  5. These opcodes are executed and the HTML generated.
  6. Same HTML is send back to Browser.

Q7. What are the different errors in PHP?

There are 4 basically types of error.

Parse Error – Commonly caused due to syntax mistakes in codes e.g. missing semicolon, mismatch brackets.

Fatal Error – These are basically run time errors which are caused when you try to access what can’t be done. E.g. accessing a dead object, or trying to use a function that hasn’t been declared.

Warning Error – These occurs when u try to include a file that is not present, or delete a file that is not on the server. This will not halt the script; it will give the notice and continue with the next line of the script.

Notice Error – These errors occurs when u try to use a variable that hasn’t been declared, this will not halt the script, It will give the notice and continue with the next line of the script.

Q8. What are the various methods/ways to pass data from one web page to another web page?

The different ways to pass the data as follows:

  1. Session
  2. Cookie
  3. Database
  4. URL parameters

Q9. What is session and why do we use it?

Session is a super global variable that preserve data across subsequent pages. Session uniquely defines each user with a session ID, so it helps making customized web application where user tracking is needed.

>>Read More>>

https://www.mytectra.com/interview-question/php-interview-questions-and-answers-for-freshers-2018/

About the Author

Venkatesan Software Developer in suffixtree technologies. Python training in bangalore

Rate this Article
Author: Venkatesan Murugan

Venkatesan Murugan

Member since: Jun 07, 2017
Published articles: 12

Related Articles