PHP Developer Interview Questions

Name the Four Fundamental Principles of OOP?
What is the difference between PUBLIC, PRIVATE AND PROTECTED
  • PUBLIC scope to make that variable/function available from anywhere, other classes and instances of the object.
  • PRIVATE scope when you want your variable/function to be visible in its own class only.
  • PROTECTED scope when you want to make your variable/function visible in all classes that extend current class including the parent class.
  • Manual

Describe the difference from an array and an associative array?
Arrays in PHP are really “maps” not the strict arrays you find in other languages. The main difference is that you define the indexes in the associative array. While when you do not define the indexes are defined by the system starting at 0 and incremented by 1. Manual
Describe the difference between double equals (==) and triple equals (===)
Directly from the manual:
$a == $b Equal TRUE if $a is equal to $b after type juggling.
$a === $b Identical TRUE if $a is equal to $b, and they are of the same type.


Give an example of using GROUP BY in MySQL

Explain the difference between WHERE and HAVING in MySQL?
They function similarly, but their uses differ. The WHERE statement is used to filter field values that are in the table. The HAVING statement is used to filter calculated values, like sum().