Explain the difference between echo() and print() statement? When might you use one over the other?
PHP Language Features Interview Questions
Questions to ask a PHP Developer
PHP engineers are often required to have a knowledge of the full web stack: starting with the ability to write optimized SQL queries, and wrapping up with a good understanding of HTML/CSS. When interviewing a PHP developer, make sure that you think through your requirements and ask good questions for all of them.
Here's a suggestion for a good menu of PHP interview questions:
- Start off with some basic SQL such as SQL Skills: Joins, Averages and Sums
- Include at least one simple coding task such as Separate a list of integers or Find the missing number
- Explore their ability to come up with an overall system design and data model with a flexible question like Design a restaurant reservation system or Design a card game system
- Ensure that they have a solid understanding of the basic building blocks of the web by asking about HTTP GET and POST or What are HTTP cookies?
- Wrap up with some CSS questions like Explore the HTML display and position attributes or CSS rule-set basics
Most languages have a built in sort method that will sort an array of strings alphabetically. Demonstrate how to sort an array of strings by the length of each string, shortest strings first.
Define the following object oriented concepts:
- Class, object (and the difference between the two)
- Instantiation
- Method (as opposed to, say, a C function)
- Static methods and classes
- Destructor/finalizer
- Inheritance
- Encapsulation
- Multiple inheritance (and give an example)
- Abstract class
- Interface/protocol (and different from abstract class)
- Method overriding
- Method overloading (and difference from overriding)
- Polymorphism (without resorting to examples)
- Method visibility (e.g. public/private/other)
How many ways can an argument be passed to a method. Explain each method.
Explain the difference between method overloading and method overriding
Explain the difference between require_once(), require() and include() and when you might use these