FullStackFSCCafé
 
 
Sign in with GoogleSign in with Google. Opens in new tab
Kill Your Tech Interview
3877 Full-Stack, Algorithms & System Design Interview Questions
Answered To Get Your Next Six-Figure Job Offer
      
🤖 Having Machine Learning & DS Interview? Check  MLStack.Cafe - 1704 Data Science & ML Interview Questions & Answers!Having ML & DS Interview? Check 🤖 MLStack.Cafe - 1704 ML & DS Interview Questions and Answers

Top 82 PHP Interview Questions

Entry Junior Mid Senior Expert
Sign in with GoogleSign in with Google. Opens in new tab
Topic Progress:

Theoretical Questions

Q1:   

What is the use of ini_set()?

  
Add to PDF   Entry 
Q2:   

What is the return type of a function that doesn't return anything?

  
Add to PDF   Entry 
Q3:   

What does $GLOBALS mean?

  
Add to PDF   Entry 
Q4:   

How can you pass a variable by reference?

  
Add to PDF   Entry 
Q5:   

What is the purpose of php.ini file?

  
Add to PDF   Entry 
Q6:   

What are the keys & values in an indexed array?

  
Add to PDF   Entry 
Q7:   

What is the difference between == and ===?

  
Add to PDF   Entry 
Q8:   

What are the differences between die() and exit() functions in PHP?

  
Add to PDF   Junior 
Q9:   

Is multiple inheritance supported in PHP?

  
Add to PDF   Junior 
Q10:   

Explain what the different PHP errors are

  
Add to PDF   Junior 
Q11:   

Explain usage of enumerations in PHP

  
Add to PDF   Junior 
Q12:   

Explain how we handle exceptions in PHP?

  
Add to PDF   Junior 
Q13:   

What are the main differences between const vs define

  
Add to PDF   Junior 
Q14:   

What's the difference between isset() and array_key_exists()?

  
Add to PDF   Junior 
Q15:   

Can you extend a Final defined class?

  
Add to PDF   Junior 
Q16:   

What are PSRs? Choose 1 and briefly describe it.

  
Add to PDF   Junior 
Q17:   

How can you enable error reporting in PHP?

  
Add to PDF   Junior 
Q18:   

When should I use require vs include?

  
Add to PDF   Junior 
Q19:   

What are the different scopes of variables?

  
Add to PDF   Junior 
Q20:   

What is the difference between var_dump() and print_r()?

  
Add to PDF   Junior 
Q21:   

What is the difference between single-quoted and double-quoted strings in PHP?

  
Add to PDF   Junior 
Q22:   

How is it possible to set an infinite execution time for PHP script?

  
Add to PDF   Junior 
Q23:   

Give me some real life examples when you had to use __destruct in your classes

  
Add to PDF   Junior 
Q24:   

In PHP, objects are they passed by value or by reference?

  
Add to PDF   Junior 
Q25:   

What is the differences between $a != $b and $a !== $b?

  
Add to PDF   Junior 
Q26:   

Differentiate between echo and print()

  
Add to PDF   Junior 
Q27:   

What is stdClass in PHP?

  
Add to PDF   Junior 
Q28:   

What does the 'var' keyword mean in PHP?

  
Add to PDF   Junior 
Q29:   

Is there a difference between isset and !empty?

  
Add to PDF   Junior 
Q30:   

What do we mean by keys and values?

  
Add to PDF   Junior 
Q31:   

What is PDO in PHP?

  
Add to PDF   Junior 
Q32:   

What is the difference between MySQL, MySQLi and PDO?

  
 Add to PDF   Mid 
Q33:   

Is there a function to make a copy of a PHP array to another?

  
 Add to PDF   Mid 
Q34:   

Does PHP support method overloading?

  
 Add to PDF   Mid 
Q35:   

What is use of Null Coalesce Operator?

  
 Add to PDF   Mid 
Q36:   

What is the difference between using self and $this?

  
 Add to PDF   Mid 
Q37:   

Explain function call by reference

  
 Add to PDF   Mid 
Q38:   

Why do we use extract()?

  
 Add to PDF   Mid 
Q39:   

What is autoloading classes in PHP?

  
 Add to PDF   Mid 
Q40:   

Differentiate between parameterised and non parameterised functions

  
 Add to PDF   Mid 
Q41:   

What are some of the big changes PHP has gone through in the past few years?

  
 Add to PDF   Mid 
Q42:   

Explain the difference between exec() vs system() vs passthru()?

  
 Add to PDF   Mid 
Q43:   

Is there any reason to use strcmp() for strings comparison?

  
 Add to PDF   Mid 
Q44:   

Explain the difference between shell_exec() and exec()

  
 Add to PDF   Mid 
Q45:   

What is the difference between a PHP interpreter and a PHP handler?

  
 Add to PDF   Mid 
Q46:   

What is the difference between PDO's query() vs execute()?

  
 Add to PDF   Mid 
Q47:   

Maximum how many arguments are allowed in a function in PHP?

  
 Add to PDF   Mid 
Q48:   

Are Parent constructors called implicitly inside a class constructor?

  
 Add to PDF   Mid 
Q49:   

When should I use require_once vs require?

  
 Add to PDF   Mid 
Q50:   

Differentiate between exception and error

  
 Add to PDF   Mid 
Q51:   

What exactly is the the difference between array_map, array_walk and array_filter?

  
 Add to PDF   Mid 
Q52:   

What are the exception class functions?

  
 Add to PDF   Mid 
Q53:   

What is the crucial difference between using traits versus interfaces?

  
 Add to PDF   Senior 
Q54:   

What's better at freeing memory with PHP: unset() or $var = null?

  
 Add to PDF   Senior 
Q55:   

Does PHP have threading?

  
 Add to PDF   Senior 
Q56:   

What does yield mean in PHP?

  
 Add to PDF   Senior 
Q57:   

Compare MySQLi or PDO - what are the pros and cons?

  
 Add to PDF   Senior 
Q58:   

What are the disadvantages of using persistent connection in PDO?

  
 Add to PDF   Senior 
Q59:   

What does $$ mean?

  
 Add to PDF   Senior 
Q60:   

How to turn errors into exceptions in PHP?

  
 Add to PDF   Senior 
Q61:   

Is PHP single or multi threaded?

  
 Add to PDF   Senior 
Q62:   

Store an array as JSON or as a PHP serialized array?

  
 Add to PDF   Senior 
Q63:   

What exactly are late static bindings in PHP?

  
 Add to PDF   Senior 
Q64:   

What is the best method to merge two PHP objects?

  
 Add to PDF   Senior 
Q65:   

What is use of Spaceship Operator?

  
 Add to PDF   Senior 
Q66:   

explain what is a closure in PHP and why does it use the “use” identifier?

  
 Add to PDF   Senior 
Q67:   

Explain the Exception Hierarchy introduced in PHP7

  
 Add to PDF   Senior 
Q68:   

What does a $$$ mean in PHP?

  
 Add to PDF   Expert 
Q69:   

Explain the Order of Precedence for Traits in PHP

  
 Add to PDF   Expert 
Q70:   

Are PDO prepared statements sufficient to prevent SQL injection?

  
 Add to PDF   Expert 

Code Challenges

Q1:   

PHP array delete by value (not key)

  
 Add to PDF   Junior 
Q2:   

Declare some function with default parameter

  
 Add to PDF   Junior 
Q3:   

What will be returned by this code?

  
  Add to PDF   Mid 
Q4:   

What does the following code output?

  
  Add to PDF   Mid 
Q5:   

How do I pass variables and data from PHP to JavaScript?

  
  Add to PDF   Mid 
Q6:   

What will be returned by this code? Explain the result.

  
  Add to PDF   Mid 
Q7:   

Check if PHP array is associative

  
  Add to PDF   Mid 
Q8:   

Let's create Enumerations for PHP. Prove some code examples.

  
  Add to PDF   Mid 
Q9:   

How would you create a Singleton class using PHP?

  
  Add to PDF   Mid 
Q10:   

How to measure execution times of PHP scripts?

  
  Add to PDF   Senior 
Q11:   

How could we implement method overloading in PHP?

  
  Add to PDF   Expert 
Q12:   

Provide some ways to mimic multiple constructors in PHP

  
  Add to PDF   Expert 
 

Rust has been Stack Overflow’s most loved language for four years in a row and emerged as a compelling language choice for both backend and system developers, offering a unique combination of memory safety, performance, concurrency without Data races...

Clean Architecture provides a clear and modular structure for building software systems, separating business rules from implementation details. It promotes maintainability by allowing for easier updates and changes to specific components without affe...

Azure Service Bus is a crucial component for Azure cloud developers as it provides reliable and scalable messaging capabilities. It enables decoupled communication between different components of a distributed system, promoting flexibility and resili...

Cosmos DB has gained popularity among developers and organizations across various industries, including finance, e-commerce, gaming, IoT, and more. Follow along and learn the 24 most common and advanced Azure Cosmos DB interview questions and answers...
More than any other NoSQL database, and dramatically more than any relational database, MongoDB's document-oriented data model makes it exceptionally easy to add or change fields, among other things. It unlocks Iteration on the project. Iteration f...
Unit Tests and Test Driven Development (TDD) help you really understand the design of the code you are working on. Instead of writing code to do something, you are starting by outlining all the conditions you are subjecting the code to and what outpu...
Domain-Driven Design is nothing magical but it is crucial to understand the importance of Ubiquitous Language, Domain Modeling, Context Mapping, extracting the Bounded Contexts correctly, designing efficient Aggregates and etc. before your next DDD p...
At its core, Microsoft Azure is a public cloud computing platform - with solutions including Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) that can be used for services such as analytics, virtual c...
As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications. Follow along to refresh your knowledge and explore the 52 most frequently asked and advanced Node JS Interview Questions and Answers every...
Dependency Injection is most useful when you're aiming for code reuse, versatility and robustness to changes in your problem domain. DI is also useful for decoupling your system. DI also allows easier unit testing without having to hit a database and...