Latest PHP interview questions - 2018

Posted on 04th Dec 2017 03:29 PM

iMatrix Solutions Offer ADVANCED WEB DESIGNING/PHP/SEO online/classroom course, hyderabad:by experienced faculty who are real time industry experts and web designers indeed. We Global I-Matrix Software Solutions are one of the best Web designing and development company in Hyderabad, India.For details and clarification contact us: 040-42204594, +91 9000866282. mail us at:

List out the 3 main differences between session and cookies
Sessions are stored in server which can hold multiple variables. Session expiry time is specified in configuration and remains active as long as browser is open. It is mainly used for login and logout purpose
Cookies are stored on user’s computer, those can be viewed in web browser options and cannot hold multiple variables. We have to set expiry time for each cookie. Sensitive information should not be stored in cookies.
How to redirect a page in php ?
How is isset() in php used ?
It is used to identify whether variable is set and is not NULL
How to get value for current session id?
What is meant by sql injection ?
sql injection is the most hacking techniques, it is the code injection that destroys your database by placing malicious code in sql statements via web page input.
What is Simple XML in php ?
It is an extension which allows us to manipulate easily and get XML data
What is php libxml ?
Libxml functions and constants used together with XSLT, SimpleXML and DOM functions. These functions require libxml package
What are the rules for naming a variable in php ?
Variables in php must start with a letter or underscore character, but cannot start with a number and can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) 
How will you link 2 strings in php ?
To link the 2 string variables use dot (.) or comma(,) operator
$string1=’’Good Morning’’;
echo $string1 . “ “ . $string2;
Final output is 
Good Morning 1234
How to find the length of the string ’’Good Morning’’ ?
strlen() is the function which is used to find the length of the string
echo strlen (’’Good Morning!’’) ;
And the output is 13
Variables including space and exclamatory mark has to be counted
How will you check if the file exists in php ?
How is the session started in php ?
A php session is started by making a call to the session_start() function
How is the session destroyed in php ?
How do split function works ?
Split function divides a string into various elements, the elements are based on occurence of pattern in a string.
What is the fullform of PEAR and what is it?
PEAR - PHP Extension and Application Repository. It is a framework and distribution system reusable for php components and provides command line interface to install packages automatically.
What are the different data types in php?
There are 3 different types of data which are again subdivided into many types
Scalar type :
  • Boolean
  • Integer
  • Float
  • String 
Compound type :
  • Array
  • Object
Special type :
  • Resource
  • Null