Company-wise PHP questions (TCS, Infosys, etc.)

🏢 1. TCS PHP Interview Questions

👉 Focus: Basics + Logic + Clean Coding

🔹 Common Questions:

  1. What is PHP? How does it work?
  2. Difference between GET and POST
  3. What are sessions and cookies?
  4. Difference between echo and print
  5. Write a function to check prime number
  6. Reverse a string using function
  7. What is isset() vs empty()
  8. Types of errors in PHP
  9. What is MVC?
  10. Simple program using function (sum, factorial)

💻 Coding Example:

function isPrime($num) {
if ($num <= 1) return false;
for ($i = 2; $i < $num; $i++) {
if ($num % $i == 0) return false;
}
return true;
}

🏢 2. Infosys PHP Interview Questions

👉 Focus: Concept + Practical Understanding

🔹 Common Questions:

  1. What are PHP functions?
  2. Types of arrays in PHP
  3. What is recursion? Example
  4. Difference between include and require
  5. What are superglobals?
  6. What is a closure?
  7. Explain array_map() and array_filter()
  8. How to connect PHP with MySQL?
  9. What is OOP in PHP?
  10. What is XSS and SQL Injection?

💻 Coding Example:

$arr = [1,2,3,4];$result = array_filter($arr, function($n){
return $n % 2 == 0;
});print_r($result);

🏢 3. Wipro PHP Interview Questions

👉 Focus: Logic + Real Use Cases

🔹 Common Questions:

  1. Difference between == and ===
  2. What is function overloading?
  3. What are variable functions?
  4. What is explode() and implode()?
  5. Write recursive function for factorial
  6. What is session management?
  7. How to upload file in PHP?
  8. What is $_POST and $_GET?
  9. What is API?
  10. What is JSON?

💻 Coding Example:

function factorial($n) {
if ($n == 0) return 1;
return $n * factorial($n - 1);
}

🏢 4. Accenture PHP Interview Questions

👉 Focus: Scenario-based + Problem Solving

🔹 Common Questions:

  1. How PHP handles form data?
  2. What are cookies vs sessions?
  3. How to secure a PHP application?
  4. What is REST API?
  5. What is middleware?
  6. What is callable type?
  7. Explain closures with example
  8. Difference between frontend and backend
  9. What is AJAX?
  10. How to optimize PHP performance?

💻 Coding Example:

$sum = fn($a, $b) => $a + $b;
echo $sum(5, 10);

🏢 5. HCL / Tech Mahindra / Capgemini

👉 Focus: Mixed (Basic + DB + Web)

🔹 Common Questions:

  1. What is PHP lifecycle?
  2. What are superglobals ($_SERVER, $_SESSION)
  3. What is MVC architecture?
  4. What is Composer?
  5. What is Laravel?
  6. Difference between require_once and include_once
  7. How to handle errors in PHP?
  8. What is CSRF?
  9. How to validate forms?
  10. What is RESTful API?

🔥 HR + Technical Combined Questions

👉 Asked in almost all companies:

  • Tell me about yourself
  • Explain your PHP project
  • What challenges did you face?
  • Why should we hire you?
  • Difference between JavaScript and PHP
  • What is your role in project?

🎯 Most Important Topics (HIGH PROBABILITY)

Focus strongly on:

✅ Functions (closures, recursion)
✅ Arrays (array_map, array_filter)
✅ Forms (GET, POST)
✅ Sessions & Cookies
✅ MySQL + PHP
✅ Security (XSS, SQL Injection)
✅ OOP Basics
✅ API / JSON


🚀 Pro Tip (Very Important)

👉 Service-based companies don’t expect deep expertise
👉 They check:

  • Clear basics
  • Logic building
  • Confidence

🧠 Final Practice Set

Prepare these before interview:

  1. Palindrome function
  2. Fibonacci using recursion
  3. Login system (session-based)
  4. Form handling (POST)
  5. API fetch + JSON decode