1. Tell me what Kind of Things have you Done on the Social Side?

A pretty broad question as there are no right or wrong answers. Its more about what works. This question is purposely open ended as I just want to know what the interviewee has worked on in the past. The answer, for me is not based on how well you know Facebook and Twitter, but simply given the opportunity, do you have enough knowledge to be able to leverage social platforms to achieve a particular goal.

2. Explain what are PSRs? Choose 1 and briefly describe it?

PSRs are PHP Standards Recommendations that aim at standardising common aspects of PHP Development.

An example of a PSR is PSR-2, which is a coding style guide. More info on PSR-2 here.

3. Tell me can the value of a constant change during the script's execution?

No, the value of a constant cannot be changed once it's declared during the PHP execution.

4. Explain me what is the w3c?

Standards compliance in web development is where everything is (hopefully?) going. Don't ask them to recite the w3c's mission statement or anything, but they should at least have a general idea of who they are.

5. Do you know what are Traits?

Traits are a mechanism that allows you to create reusable code in languages like PHP where multiple inheritance is not supported. A Trait cannot be instantiated on its own.

It's important that a developer know the powerful features of the language (s)he is working on, and Trait is one of such features.

6. Explain do you use Composer? If yes, what benefits have you found in it?

A: Using Composer is a tool for dependency management. You are able to declare the libraries your product relies on and Composer will manage the installation and updating of the libraries. The benefit is a consistent way of managing the libraries you depend on and you will spend less time managing the libraries you depend on in your project.

7. Explain briefly about a Search-friendly Site Looks Like?

Pretty basic I know, but I'm looking to find out whether or not the applicant has updated what he or she knows about on-site optimisation. Keyword research, title tags, urls, content, alt tags, site structure, navigation, internal linking, site maps, subdomains are all part of what I'm expecting to hear. However, what I don't what to hear is:

☛ Google can't crawl javaScript
☛ Google can't follow JavaScript links
☛ Keyword density must be X percent
☛ Google can't read Ajax
☛ Meta keywords are very important and should spend time including them
☛ Meta descriptions are not so important

If I'm still hearing this kind of things in 2012 it is most likely they may not be right for the top job.

8. Explain what is Memcache?

Memcache is a technology that caches objects in memory such that your web application can get to them really fast. It is used by sites such as Digg.com, Facebook.com and NowPublic.com and is widely recognized as an essential ingredient in scaling any LAMP.

9. Do you know what is Zend Engine?

☛ Zend Engine is used internally by PHP as a compiler and runtime engine. PHP Scripts are loaded into memory and compiled into Zend opcodes.
☛ These opcodes are executed and the HTML generated is sent to the client.
☛ The Zend Engine provides memory and resource management, and other standard services for the PHP language. Its performance, reliability and extensibility played a significant role in PHP's increasing popularity.

10. Tell me what are SQL Injections, how do you prevent them and what are the best practices?

SQL injections are a method to alter a query in a SQL statement send to the database server. That modified query then might leak information like username/password combinations and can help the intruder to further compromise the server.

To prevent SQL injections, one should always check & escape all user input. In PHP, this is easily forgotten due to the easy access to $_GET & $_POST, and is often forgotten by inexperienced developers. But there are also many other ways that users can manipulate variables used in a SQL query through cookies or even uploaded files (filenames). The only real protection is to use prepared statements everywhere consistently.

Do not use any of the mysql_* functions which have been deprecated since PHP 5.5 ,but rather use PDO, as it allows you to use other servers than MySQL out of the box. mysqli_* are still an option, but there is no real reason nowadays not to use PDO, ODBC or DBA to get real abstraction. Ideally you want to use Doctrine or Propel to get rid of writing SQL queries all together and use object-relational mapping which binds your rows from the database to objects in your application.

11. Tell us what skills and technologies are you the most interested in improving upon or learning?

Find out if their future interests match the direction of the position (or the company in general).

12. Explain me soundex() and metaphone()?

soundex()
The soundex() function calculates the soundex key of a string. A soundex key is a four character long alphanumeric strings that represents English pronunciation of a word. The soundex() function can be used for spelling applications.
<?php
$str= “hello”;
Echo soundex($str);
?>
metaphone()
the metaphone() function calculates the metaphone key of a string. A metaphone key represents how a string sounds if pronounced by an English person. This function can also be used for spelling applications.
<?php
echo metaphone(“world”);
?>

13. Tell me what are the __construct() and __destruct() methods in a PHP class?

All objects in PHP have Constructor and Destructor methods built-in. The Constructor method is called immediately after a new instance of the class is being created, and it's used to initialize class properties. The Destructor method takes no parameters.

Understanding these two in PHP means that the candidate knows the very basics of OOP in PHP.

14. Tell me what sized websites have you worked on in the past?

Find a developer that has experience similar in size to the project you're putting together. Developers with high traffic, large scale site expertise may offer skills that smaller-sized developers don't, such as fine tuning apache or optimizing heavily hit SQL queries. On the other hand, developers who typically build smaller sites may have an eye for things that large scale developers don't, such as offering a greater level of visual creativity.

15. Explain me what SEO Tools do you Use?

Finally, I always ask what tools they have used in the past. Generally speaking, I would expect a combination of OSE, Majestic SEO and Ahrefs for link analysis. Either Screaming Frog or Xenu for architecture diagnostics and AWR would normally come out top for rank analysis. And of course, Google Analytics the most likely tool for traffic monitoring.

16. Explain what are some new features introduced in PHP7?

1. Zend Engine 3 performance improvements and 64-bit integer support on Windows
2. uniform variable syntax AST-based compilation process
3. added Closure::call()
4. bitwise shift consistency across platforms
5. (null coalesce) operator
6. Unicode codepoint escape syntax
7. return type declarations
8. and scalar type (integer, float, string and boolean) declarations.

17. How 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 You can ask your wish is printed, and ballCount is reset to 0. How would you implement this class?

<?php
class dragonBall{
private $ballCount;

public function __construct(){
$this->ballCount=0;
}

public function iFoundaBall(){
$this->ballCount++;
if($this->ballCount===7){
echo "You can ask for your wish.";
$this->ballCount=0;
}
}
}
?>
This question will evaluate a candidate’s knowledge about OOP.

18. Do you know how to enable error reporting in PHP?

Check if “display_errors” is equal “on” in the php.ini or declare “ini_set('display_errors', 1)” in your script.
Then, include “error_reporting(E_ALL)” in your code to display all types of error messages during the script execution.

Enabling error messages is very important especially during the debugging process as you can instantly get the exact line that is producing the error and you can see also if the script in general is behaving correctly.

19. Tell us who was your best boss and who was the worst?

I've learned from each boss I've had. From the good ones I learnt what to do, from the challenging ones - what not to do.
Early in my career, I had a mentor who helped me a great deal, we still stay in touch. I've honestly learned something from each boss I've had.

20. Tell me what industry sites and blogs do you read regularly?

This question can give you an idea of how in-tune they are with the latest industry trends and technologies, as well as how passionate they are about webdev. It'll help separate the people who do it as a career AS WELL as a hobby from those who might simply be in it for the big developer paychecks.

21. Tell me what is htaccess? Why do we use this and where?

☛ htaccess files are configuration files of Apache Server that provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.
☛ These .htaccess files are used to change the functionality and features of Apache web server.
For instance, htaccess file is used for url rewrite.
–> It is used to make the site password protected.
–> .htaccess file can restrict some ip addresses so that on restricted ip addresses, the site will not open.

22. Explain why would we use === instead of ==?

If you would want to check for a certain type, like an integer or boolean, the === will do that exactly like one would expect from a strongly typed language, while == would convert the data temporarily and try to match both operand's types. The identity operator (===) also performs better as a result of not having to deal with type conversion. Especially when checking variables for true/false you want to avoid using == as this would also take into account 0/1 or other similar representation.

23. Suppose we receive a form submitted by a post to subscribe to a newsletter. This form has only one field, an input text field named email. How would we validate whether the field is empty? Print a message "The email cannot be empty" in this case?

<?php
if(empty($_POST['email'])){
echo "The email cannot be empty";
}
?>
In this question, you will be evaluated on your knowledge about forms management and validation. There is not unique answer for this question, but it must be similar to this one.

24. Tell me what is the difference between GET and POST?

☛ GET displays the submitted data as part of the URL, during POST this information is not shown as it's encoded in the request.
☛ GET can handle a maximum of 2048 characters, POST has no such restrictions.
☛ GET allows only ASCII data, POST has no restrictions, binary data are also allowed.
☛ Normally GET is used to retrieve data while POST to insert and update.

Understanding the fundamentals of the HTTP protocol is very important to have a good start as a PHP developer, and the differences between GET and POST are an essential part of it.

25. Tell me what's your favorite development language and why? What other features (if any) do you wish you could add to this language?

Asking about feature additions is a particularly valuable question - it can reveal if they're skilled in programming in general or if their skillset is pigeonholed into their language of choice.

26. Do you Code in any other Programming Language?

Whilst not a deal breaker, I think it is important that you understand how things are built on the web. Especially knowing how to fully code in html. The more web programming you know the better, and working closely with the dev team has constantly reminded me why this is important. There will be plenty of cases where being able to understand a web development language will be very advantageous. When for instance, the dev team says there is no space for particular piece of content , recommending a work around using a CSS overlay and calling it using an onClick event maybe accepted. Or telling them that how best to code in Google's language alternative tag across an already existing international site.

27. Tell me what are magic methods?

☛ Magic methods are member functions that are available to all the instance of class. Magic methods always start with “__”. Eg. __construct.
☛ All magic methods need to be declared as public
☛ To use a method, it should be defined within the class or program scope
☛ Various Magic Methods used in PHP 5 are: __construct() __destruct() __set() __get() __call() __toString() __sleep() __wakeup() __isset() __unset() __autoload() __clone().

28. Tell me what library is used for pdf in PHP?

The PDF functions in PHP can create PDF files using the PDFlib library Version 6. PDFlib offers an object-oriented API for PHP 5 in addition to the function-oriented API for PHP 4.
There is also the » Panda module. FPDF is a PHP class, which allows generating PDF files with pure PHP (without using the PDFlib library.)
F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. FPDF requires no extension (except zlib to activate compression and GD for GIF support) and works with PHP4 and PHP5.

29. Do you know what does MVC stand for and what does each component do?

MVC stands for Model View Controller.
The controller handles data passed to it by the view and also passes data to the view. It's responsible for interpretation of the data sent by the view and dispersing that data to the appropriate models awaiting results to pass back to the view. Very little, if any business logic should be occurring in the controller.

The model's job is to handle specific tasks related to a specific area of the application or functionality. Models will communicate directly with your database or other storage system and will handle business logic related to the results.

The view is passed data by the controller and is displayed to the user.

Overall, this question is worth knowing as the MVC design pattern has been used a lot in the last few years and is a very good design pattern to know. Even with more advanced flows that go down to repositories and entities, they still are following the same basic idea for the Controller and View. The Model is typically just split out into multiple components to handle specific tasks related to database data, business logic etc. The MVC design pattern helps draw a better understanding of what is being used, as a whole, in the industry.

30. Explain the value of the variable input is a string 1,2,3,4,5,6,7. How would you get the sum of the integers contained inside input?

<?php
echo array_sum(explode(',',$input));
?>
The explode function is one of the most used functions in PHP, so it’s important to know if the developer knows this function. There is no unique answer to this question, but the answer must be similar to this one.

32. Tell me what have you been doing since your last job?

If you have an employment gap on your resume, the interviewer will probably ask you what you have been doing while you were out of work.
The best way to answer this question is to be honest, but do have an answer prepared. You will want to let the interviewer know that you were busy and active, regardless of whether you were out of work by choice, or otherwise.
As I said, it doesn't really matter what you did, as long as you have an explanation. Hiring managers understand that people lose their job - it can happen to anyone - and it's not always easy to find a new job fast. Also, there are legitimate non-employment reasons for being out of the workforce.

33. Tell me how comfortable are you with writing HTML entirely by hand?

Although their resume may state that they're an HTML expert, often times many developers can't actually write an HTML document from top to bottom. They rely on an external publisher or have to constantly flip back to a reference manual. Any developer worth a damn should at least be able to write a simple HTML document without relying on external resources. A possible exercise is to draw up a fake website and ask them to write the HTML for it. Keep it simple and just make sure they have the basics down - watch for mistakes like forgetting the <head> </head> tags or serious misuse of certain elements. If they write something like: <image src="/some/image.gif">, it might be a good hint to wrap things up and call the next interviewee.

34. Explain how can we execute a PHP script using command line?

☛ Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, “php myScript.php”, assuming “php” is the command to invoke the CLI program.
☛ Remember that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

35. Tell us why did you choose this particular career path?

Sometimes in interviews, you will be asked questions that lend themselves to be answered vaguely or with lengthy explanations. Take this opportunity to direct your answer in a way that connects you with the position and company, be succinct and support your answer with appropriate specific examples.
Sample Answer: "I chose advertising because I have always been a strong communicator with a good eye for design. I have a particular interest in creating dynamic eye-catching pieces that support a new product being introduced to the market. I also like the fast-paced high-energy environment that seems to be commonplace in the advertising industry."
Advice: Your answer needs to convince the interviewers that your skills are exactly what they want. They want to know if you have a realistic view of what it is like to work in their industry. Be specific; show them that their industry and your career goals are in sync.