<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=555865791448670&amp;ev=PageView&amp;noscript=1">

PHP Interview Questions

PHP Interview Questions for experienced

 Looking for PHP interview questions? Here is the list of most important questions that can be asked in interviews. Make yourself ready with this comprehensive list of interview questions.

PHP Interview Questions:

1. How to achieve multilevel inheritance in PHP?

2. Difference between Zend framework 2 VS Zend framework 1?

3. How to pass data in header while using CURL?

4. What are the different tables (Engine) present in MySQL, which one is the default?

5. Explain the difference between MyISAM Static and MyISAM Dynamic

6. How can I retrieve values from one database server and store them in other database server using PHP?

7. What is the difference between if ('value' == $var) and if ($var == 'value')?

8. How can we prevent SQL-injection in PHP?

9. In how many ways we can retrieve the data in the result set of MySQL using PHP? What is the difference between mysql_fetch_object and mysql_fetch_array?

10. After the code below is executed, what will be the value of $text and what will strlen($text) return?

$text = 'Mike ';

$text[10] = 'Sam';

11. Consider the following code:

$x = NULL;

if ('0xFF' == 255) {

$x = (int)'0xFF';

}

What will be the value of $x after this code executes? Explain your answer.

12. What are SQL Injections, how do you prevent them and what are the best practices?

13. Suppose that you have to implement a class named Dragonball. This class must have an attribute named ballCount (which starts from 0) and a method iFoundaBall. When iFoundaBall is called, ballCount is increased by one. If the value of ballCount is equal to seven, then the message My name is John is printed, and ballCount is reset to 0. How would you implement this class?

14. What’s the difference between using mysql_ functions and PDO?

15. How can you enable error reporting in PHP?

16. How to use "MySQL in clause" for "string search" and "number search"?

17. Do you know what the PHP-FIG is? Describe it, describe the PSRs you know.

18. What are the reasons for selecting lamp (Linux, apache, MySQL, PHP) instead of the combination of other software programs, servers, and operating systems?

19. What will be the output of the code below and why?

$x = 5;

echo $x;

echo "&lt;br /&gt;";

echo $x+++$x++;

echo "&lt;br /&gt;";

echo $x;

echo "&lt;br /&gt;";

echo $x---$x--;

echo "&lt;br /&gt;";

echo $x;

20. What is wrong with this code?

class SomeClass

{

protected $_someMember;

public function _construct()

{

$this->_someMember = 1;

}

public static function getSomethingStatic()

{

return $this->_someMember * 5 // here’s the catch

}

}

21. How does one prevent the following Warning ‘Warning: Cannot modify header information – headers already sent’ and why does it occur in the first place?

22. Are objects in PHP 5 passed by value or reference? Explain

23. Why would you use === instead of ==? Explain

24. What will be the output of each of the statements below and why?

var_dump(0123 == 123);
var_dump('0123' == 123);
var_dump('0123' === 123);

25. How do you define a constant in PHP? How do you determine if a constant is defined in PHP?

26. When I open up a website you developed and it's a blank white screen, what steps do you take to troubleshoot the problem?

27.  What classes would you create to build a basic Twitter-style status system with OOP?

28. Describe your experiences with web services.

29. Have you ever used a PHP framework? What frameworks are you experienced in?

30. What frameworks do you prefer? Why?

 

Use this list of PHP Interview Questions for interview preparation. Read them, bookmark them, and even add your own interview questions in the comments below.

Sanghamitra Sarate

A passionate Digital Marketer with expertise in SEO & paid advertising. When not busy with the campaigns, I like to stay updated with latest trends in technology that are useful for recruitment & producing the content.

Plan ahead & make your own go-to list!

Get your Free PDF of
Top 60+ HR Conferences
2018-2019