Appinventiv Php Developer Interview Questions

  1. What is difference between Method overriding and overloading in PHP?
  2. How to remove duplicate values from a PHP Array?
  3. Difference between get and post method.
  4. What is Type hinting in PHP ?
  5. What is Cross-site scripting?
  6. What are the encryption functions available in PHP ?
  7. What is purpose of @ in Php ?
  8. What are the indexes in MySQL?
  9. What are the types of database engines available in MySQL?
  10. Do you know design patterns. List few?
  11. What is Abstract class?
  12. What is difference between strstr() and stristr() in PHP?
  13. What is difference between Group by and order by clause?
  14. How to find Second highest salary from a table ?
Appinventiv Php Developer Interview Questions
Download Appinventiv Php Developer Interview Questions PDF

Overriding and Overloading both are oops concepts.

In Overriding, a method of the parent class is defined in the child or derived class with the same name and parameters. Overriding comes in inheritance.

An example of Overriding in PHP.

<?php

class A {
   function showName() {
      return "Ajay";
   }
}

class B extends A {
   function showName() {
      return "Anil";
   }
}

$foo = new A;
$bar = new B;
echo($foo->myFoo()); //"Ajay"
echo($bar->myFoo()); //"Anil"
?>

In Overloading, there are multiple methods with the same name with different signatures or parameters. Overloading is done within the same class. Overloading is also called early binding or compile time polymorphism or static binding.

An example of Overloading in PHP

<?php 
class A{

function sum($a,$b){
	return $a+$b;

}

function sum($a,$b,$c){
	return $a+$b+$c;

}

}

$obj= new A;
$obj->sum(1,3); // 4
$obj->sum(1,3,5); // 9
?>

You can use library function array_unique() for removing duplicated values for an array. Here is syntax to use it.

<?php
	$a=array("a"=>"home","b"=>"town","c"=>"town","php");
	print_r(array_unique($a));
?>


Some differences are:

GETPOST
It claims request parameter in URL StringIt claims request parameter in the request body
It is able to send a minute amount of dataIt is able to send a great amount of data
It can be cached and bookmarked.It is not able to cache and bookmarked
It is efficient for the view purposeIt is efficient for the update-purpose

Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications. XSS enables attackers to inject client-side script into web pages viewed by other users. A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same-origin policy.

crypt(), Mcrypt(), hash() are used for encryption in PHP

In PHP @ is used to suppress error messages.When we add @ before any statement in php then if any runtime error will occur on that line, then the error handled by PHP