SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    England
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Interview Questions for a PHP Programmer

    I am looking to employ a PHP programmer and interested in what people here would recommend as interview questions. I am looking for someone who boths shows knowledge but also the ability to learn; so it could be that they have to perform a task. They will likely be paid for the interview; so it taking a few hours is fine.

    Anyway, any suggestions for questions?

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    If it is a task

    The first thing I would do is look at your candidates from two sides:

    1 - What kind of "Programmer" is he? or is he not?
    2 - Does this "Programmer" happen to know the ins and outs of PHP

    Honestly, I may be stepping on some toes here, but I have yet to see a coder who is a one talent wonder, meaning, they know PHP only and are at the top of their game.

    In terms of an interview, I'd setup a fundamental programming task such as a math function like a factorial, but have them try it in c++, vb, and php.

    See how far they get. If the code shows that they knew how to at least get the basic parts down, but they don't know the synatax, that is ok, that is still a potential good programmer.

    Since that is a quick test, you can then go on to test #2 which would be something like problem solving where you want a few values to be read in from a text config file, displayed on screen, and e-mailed... make sure the smtp server is up and running and they can access it from that server as to not make it too hard... A good coder would do this very quickly... a bad php coder would struggle with just creating the text file because you didn't specify a specific file format. A good coder would whip out a quick csv or .ini compatible file and take off... A coder getting stuck on the smtp portion is really neither her nor there.

    Just some simple ideas... I can give you more if you want to expand on anything. I would definatly ask them questions about classes, inheritance (which php versions are more or less standard OOP languages, which are not, etc).

    Good Luck,
    Wil Moore III, MCP | Integrations Specialist | Senior Consultant
    DigitallySmooth | HotBusinessDirectory

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    England
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I am only interested in a programmer who can work straight out on PHP. I have no interest in their ability in other languages (apart from javascript/SQL). Ability in another language might be useful to show their apptitude but it is no use to me if they start working the next day and they don't know PHP.

    That email part sounds like a good idea.

    I guess, what I am trying to determine is someone who is very familiar with PHP; I am not sure the best way to test for this. I realise the Zend Certification is the sort of thing I am looking for, but in my mind that is too much of a test of knowledge than of problem solving.

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let's define 'programmer'

    1) 'Programmer' is a person who composes, debugs and documents computer programs
    2) 'Programmer' is a person who uses computer keyboard to type in codes in some programming language

    I'm pretty sure you're looking for number one, not two and the real No 1 must know something else that php, just because php is a 'toy' language. She must at least be able to read C (not C++) , Java or perl is a big +.

    In general I'd follow nice advices here [http://www.joelonsoftware.com/articl...00000073.html] , the technical part can be of course adapted to your need.

    Some examples:

    1. General programming questions

    a. What does this (pseudo) code do
    Code:
    a = array(3, 2, 1, 0); b = array(); i = 0;
    while(b[i++] = a[i++]);
    b. Take a simple string function (strlen, strchr, strrev). Write it in C. Write it in PHP

    c. Write one of ctype_xxx . Optimize by size. Optimize by speed.

    2. PHP specific questions

    a. Why register_globals (magic_quotes) is evil. Provide an example. How to avoid it.

    b. You have to check if input field is filled in. What will you use
    - isset
    - empty
    - isset and strlen

    c. You have to check if input field is a number. What would you use:
    - is_int
    - is_numeric
    - regular expression

    3. General web-programming related questions

    a. Your browser accesses the page "www.host.com/index.php". The php script there redirects to "www.host.com/index2.php". Write down http dialogue (requests and responses) between your browser and remote host.

    b. Give an example of XSS attack.

    c. Compare Firefox and MSIE. Their strong and weak sides.

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    UK
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Better yet, tell them to send along their portfolio of websites and PHP applications that they have written. Then get someone who knows what to look for to review it. Then get the candidates in for an interview and question them about the code in detail just to prove that they actually wrote it themselves. Then set them a coding task and review the results.

  6. #6
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    UK
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    a. What does this (pseudo) code do
    Code:

    a = array(3, 2, 1, 0); b = array(); i = 0; while(b[i++] = a[i++]);


    NOTHING

  7. #7
    SitePoint Addict
    Join Date
    Nov 2001
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Roger Ramjet
    Better yet, tell them to send along their portfolio of websites and PHP applications that they have written. Then get someone who knows what to look for to review it. Then get the candidates in for an interview and question them about the code in detail just to prove that they actually wrote it themselves. Then set them a coding task and review the results.
    Looking at other PHP apps they've written is definitely the way to go. Many good programmers will not do well on a test. If anything, give them a task and send them home with it to let them work in a comfortable environment. Maybe give them a mySQL database full of data and ask them to write a search engine that uses AND/OR and fulltext search capabilities. Not overly hard, but a bad programmer would not build a great search engine.You will be able to test the app to make sure the search results are accurate.

    I think you must evaluate what kind of person you're hiring and just assume they are not lying about their background (check references to be safe). If it turns out they can't do the job then you can let them go during their probationary period.

  8. #8
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Roger Ramjet
    a. What does this (pseudo) code do
    Code:

    a = array(3, 2, 1, 0); b = array(); i = 0; while(b[i++] = a[i++]);


    NOTHING
    Wrong

  9. #9
    SitePoint Wizard Sillysoft's Avatar
    Join Date
    May 2002
    Location
    United States :)
    Posts
    1,691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well in my interview for my current programming position I was sent sample code. My job was to redo the code the way I think it should be. Also jot out the pros and cons of the sample code they gave me. This was sent to me via email so I was able to do it at home.

    Some questions I was asked:
    1. Do I know MVC
    2. Do I know OOP
    3. Have I dealt with triggers and sql functions
    4. Familiar with mysql and postgres

    The idea is to see how they think in terms of resolving programming issues.

    Silly

  10. #10
    SitePoint Enthusiast topsmith's Avatar
    Join Date
    Feb 2005
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don`t think that the tests (php, sql, html? in our case) from brainbank.com (brainbanchbank.com or brainbench.com or smthing, I don`t remember the name right now) are relevant when you are trying to hire a php developer.

    A test is better:
    do a "phone book" application.
    features: view, add, edit/delete contacts.
    Give them a decent editor (vim?) and phpMyAdmin.
    Ask them to add a search box there.

  11. #11
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    You want a PHP Programmer. The person should be good with reasoning & logic behind programming, if you are not looking for an expert, then you can ignore if the person is a bit hesitant or rusty with syntax/proper functions as that can be brushed with the manual. So here's what I'll suggest you do in the prescribed order.
    • If he's go a portfolio, select a couple or 3 websites from it & discuss them as to how he made them, what logic he used & why he used that logic & approach.
    • Test him on programming logic.
    • Then test him on PHP usage, how well he can use PHP
    • Then test him on Database usage(prioritise the database that you intend to use more often)
    You need to know what you are talking & testing him on, meaning you ought to know PHP etc. Otherwise he can bluff it all to you & you won't notice. So better get someone who knows PHP quite well to interview him along with you if you don't know PHP.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  12. #12
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    England
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the comments. He will be working directly with me on PHP (thats what I do) so thats not the problem. I am not looking for someone who is a God on OOP design patterns for someone; but for someone who does know the ins and outs of PHP. Its not an easy thing to test for.

    I was thinking a good question would be to ask them to pick 3 PHP applications they like and explain why.

  13. #13
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    UK
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by shakin
    I think you must evaluate what kind of person you're hiring and just assume they are not lying about their background (check references to be safe). If it turns out they can't do the job then you can let them go during their probationary period.
    Well now, I hired a contracter who was MCPed up to his armpits to sort out a W2K network I inherited; W2K not my speciality back then so I planned to pick his brains while he was working for me. Cost me 1500 to find out that microsoft certification means NOTHING, and referances little more. Left the network in a worse state than before he touched it. In the end I bought a book and taught myself.

    Worst part was the time wasted, and the possible good people I did not hire instead. Sacking someone during their probationary period means wasted money, time and possible damage to the project or systems they are working on = Failure all around. Far better to take the time and get someone who has proved they can do the job before you hire them.

  14. #14
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Certainly wouldn't test them on the ability to recall PHP function argument order...I consider myself to be a reasonably advanced PHP programmer but I'm always looking up functions in the manual, just because there is so much variance/inconsistency.

    You could possibly ask them what, in their opinion, are good practices (this could be general or PHP-related). See what they come up with without prompting.

  15. #15
    SitePoint Zealot
    Join Date
    Feb 2005
    Location
    UK
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree Luke, I am always refering to the manual myself be it PHP, SQL, HTML, VB, Javascript, UNIX, W2K or whatever - no one can know it all. about a single language or system let alone all the technologies we have to deal with these days. That is why I would be most interested to see some source code from their portfolio: is it well structured? are there comments and explanations so that someone else can maintain it? These days I would use their understanding and implementation of CSS as a benchmark of programming competance: if they can't do CSS properly then they are not going to be much good with a high-level language like PHP either.

  16. #16
    SitePoint Wizard HarryR's Avatar
    Join Date
    Dec 2004
    Location
    London, UK
    Posts
    1,376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In my opinion when looking for a PHP programmer (or any sort of programmer) the language is usually irrelevant if it's an easy to pickup language such as PHP or Python.

    Lets take the following as an example.. I know C: memory allocation, pointer arithmatic, threading/mutexes (pthreads) and a load of other stuff.. But that still does not make me a good C programmer. My code looks neat as hell, and is well documented, but still I am not a professional C developer.

    But given half the chance, I'd be working full speed within about two weeks of starting a C development job because of my experience with various other languages.

    One good question you can use is share you experiences of debugging with each other. This can be very revealing and show up the real level of skills that the person has, you may even be asked 'What do you mean by variable references?' or similar during the informal interview and be prompted to take our your red pen

    One trap I would encourage you not to get stuck in is algorithm regurgitation.. If asked on the spot right now, would you be able to recite an effecient algorithm to calculate permutations or a similar one taught in CS courses? I certainly cant!

    In all the time i've been developing using PHP, complex algorithms have been a minor part of it, with the majority being churning out database code, form processing code, error checking, image processing, text handling etc.

    Consider my 0.02p and you'll be sure to find a good developer

  17. #17
    SitePoint Addict user_A's Avatar
    Join Date
    Mar 2004
    Location
    Vancouver, BC
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stereofrog
    Wrong
    Care to explain cause i tryed to run that code and all i get is errors???

  18. #18
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well,
    if you were using c++ or something, it would loop until you got an array out of bounds error. In php it would be an endless loop would it not (since php lets you reference unitialised indices).
    or maybe Im wrong

  19. #19
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    Arizona, USA
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by user_A
    Care to explain cause i tryed to run that code and all i get is errors???
    It's pseudo-code. Not supposed to run without modification.

    What you'll basically end up with is 'a' as an array with elements (3, 2, 1, 0) and 'b' as an array with elements (2, 0).

  20. #20
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Bryan...

    Code:
    What does this do?
    
    a = array(3, 2, 1, 0); b = array(); i = 0;
    while(b[i++] = a[i++]);
    The purpose of this simple question is to test attentiveness. At first glance it looks very similar to classical K&R strcpy code:

    Code:
    void strcpy(char* s, char* t) {
        while (*s++ = *t++);
    }
    so the first impulse would be to answer: "this copies a to b". However, if you look closely at the code, you'll notice that "i" is incremented twice in a loop, so the correct answer is "this copies even elements of a to b".

    Equivalent php code:

    PHP Code:
    $a = array(3210); $b = array(); $i 0;
    while(
    $b[$i++] = $a[$i++]);
    print_r($b); 

  21. #21
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd also add, that if you as a company care about web standards, make sure the guy you take on does too.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •