= PHP Interview Questions = //Also see the [[mysql-questions#phpmysql-questions|PHP/MySQL Questions]] and [[computer-science-questions|General CS Questions]].// * What are some of the big differences between PHP4 and PHP5? * What is PEAR? * Is PHP a typed language? Why or why not? * Does PHP pass data by value or reference? What's the difference? * Outline the process for connecting to a MySQL database, walking through connecting, querying data, and getting the return value. What are some of the things that you need to watch out for? * Have you ever done any unit testing in PHP with ''php-unit'' or another package? Tell me about how it went, and some of the pros & cons. * Have you used any PHP frameworks (Zend, PEAR, etc.)? Thoughts? * What's a ''GET'' request and a ''POST'' request? What are the high-level differences between each? * What do you have to do to be able to begin a PHP file with a short tag (e.g. ''myFunction()'' and ''self::myFunction()'' ? * When is ''_destruct()'' called? * How do you catch an exception? Explain exactly how a ''try-catch'' block works. * What does the keyword ''final'' mean? * How do you make an abstract class in PHP? What does that do? * Talk about the difference between abstract classes and interfaces in PHP. In particular, discuss the fact that an interface only specifies a 'contract' of functions you have to implement, and can't specify implementation details at all, but a class an implement more than one interface. An abstract class also specifies a contract, and //does// allow you to specify implementation in the class, but PHP doesn't let you extend more than one class at once. * Have you used any of the magic methods? * What do the ''_sleep()'' and ''_wakeup()'' functions do? (Hint: in reference to ''serialize()'' and ''unserialize()'') * How about ''_get()'' and ''_set()''? What are some (dis)advantages to using ''_get()'' & ''_set()'' over conventional getter and setter functions?