Thursday, 10 August 2017

PHP Interview Questions and Answer for 3 year experienced

PHP Interview Questions and Answer for 3 year experienced

Question: What is the difference between Unlink And Unset function In PHP?
unlink It is used to delete the file permanent.
Unset It is used to delete the variable.

Question: What are PHP Traits?
It is a mechanism that allows us to do code reusability the code and its similer as that of PHP class.
trait Goodmorning {

    public function goodmorning() {
        echo "Good Morning Viewer";


trait Welcome {

    public function welcome() {
        echo "Welcome Viewer";


class Message {

    use Welcome,

    public function sendMessage() {        
        echo $this->welcome();        
        echo $this->goodmorning();


$o = new Message;

Welcome Viewer
Good Morning Viewer 

Question: How to get URL Of The Current Webpage??
Client side, connect with  parameter

Question: What Is Autoloading Classes In PHP? and how it works?
With autoloaders, PHP allows the to load the class or interface before it fails with an error.
spl_autoload_register(function ($classname) {
    include  $classname . '.php';
$object  = new Class1();
$object2 = new Class2();

Question: What s The use of ini_set()?
PHP allows the user to modify its settings mentioned in php.ini using ini_set();
For Example
Display error on page
ini_set('display_errors', '1');

Set mysql connection timeout

Set maximum execution time

Set post max size

Set upload max file size

Question: Which PHP Extension Helps To Debug The Code?
The name of that Extension is Xdebug.
It uses the DBGp debugging protocol for debugging. It is highly configurable and adaptable to a variety of situations.

Question: How can we get the properties of browswer?

Question: How to get/set the session id?
Set the session Id

Get the session Id
echo session_id()

Question: What is Scrum?
Scrum is an Agile framework for completing complex projects.
Scrum originally was made for software development projects, but it works well for any complex and innovative scope of work.

Question: What are the ways to encrypt the data?
md5() – Calculate the md5 hash of a string.
sha1() – Calculate the sha1 hash of a string.
hash() – Generate a hash value.
crypt() – One-way string hashing.

Question: How to get cookie value?
$_COOKIE ["cookie_name"];

Question: What is use of header?
The header() function is used to send a raw HTTP header to a client. It must be called before sending the actual output.

Question: What is Type juggle in PHP?
Type Juggling means dealing with a variable type. In PHP a variables type is determined by the context in which it is used.
If an integer value assign to variable it become integer.
If an string value assign to variable it become string.
If an object assign to variable it become object.

Question: What will be output of following?
$x = true and false and true;

boolean false

Question: What will be output of following?
$text = 'Arun ';
$text[10] = 'Kumar';
echo $text;

Arun K

Question: What is use of header?
header() is used to redirect from one page to another: header("Location: index.php");
header() is used to send an HTTP status code: header("HTTP/1.0 this Not Found");

header() is used to send a raw HTTP header: header('Content-Type: application/json');

No comments :

Post a Comment