Important PHP interview questions for freshers











MOST IMPORTANT INTERVIEW QUESTIONS PHP

QUESTION. How to include a file to a php page?
Answer. We can include a file using "include() " or "require()" function with file path as its parameter.

QUESTION. What is difference between “include” and “require” in php?
Answer. The include and require statements are identical, except upon failure:

require will produce a fatal error (E_COMPILE_ERROR) and stop the script
include will only produce a warning (E_WARNING) and the script will continue

QUESTION:  What are the different errors in PHP?
Answer. 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.

QUESTION: What is session and why do we use it?
Answer. 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.

QUESTION: What is cookie and why do we use it?
Answer. Cookie is a small piece of information stored in client browser. It is a technique used to identify a user using the information stored in their browser (if already visited that website) . Using PHP we can both set and get COOKIE.

To read all PHP interview questions click here.









1 comment:

  1. I have read your blog it’s very attractive and impressive. I like it your blog.
    Click for this

    ReplyDelete

We are here to listen you, Comment your valueable opinion...!!!