Link to home
Start Free TrialLog in
Avatar of melwong
melwong

asked on

How to come up with 3 advanced PHP questions

We're hiring senior PHP developer and at least 2 years experience. Can someone give me 3 advanced PHP questions that I can test the candidates?

I also need 1 question on using MySQL stored procedure
Avatar of designatedinitializer
designatedinitializer
Flag of Portugal image

1.How do you parse a huge (1Gig, e.g.) xml file in PHP?
2.How do you load any class on-the-fly without 'include' or 'require'?
3.How do you develop a real-time chat server with no page refresh?
--- Which API do you use to execute a triple MySQL query which includes a stored procedure definition and execution?
Avatar of melwong
melwong

ASKER

Oh, and I do need the answers please
Avatar of Mark Brady
I'd like to know the answers to that myself! In fact, I have just relocated from New Zealand to Florida and in doing so have been faced with finding employment as a PHP developer. Every company (and Agent) I have been to see for an interview has put me through tests. Here is what I have seen in these tests so far.

One test was made up of questions almost entirely about classes (OOP) programming and had a few questions relating to the results of a certain function they stipulated. Some of the tests were multiple choice and some not. I was a bit peeved at one test which had a good portion of their questions relating to old php version prior to 5xx.

I my opinion, you should test their knowledge on classes if that is what you use (Object Orientated Programming), and some basic PHP stuff like Arrays (single and multi-level, loading data from a file, writing functions to manipulate the date and time.

Let me interrupt and say I had typed a whole bunch of stuff in here and accidently deleted it by mistake (Shows my computers skills hey!)

In any case the most important thing to really test them on is their logic. Logic skills is more valuable to a company than pure code writing skills. Have them write a basic login system with security and a remember me function so they will need to be able to create a basic database and a table and write a cookie in php and be able to check for that cookie to see if it is valid etc...

Do the basic PHP questions then make them work for it by displaying their logic. You can tell a whole lot about a coder by the way they think and it will also show experience or their indepth knowledge.

Anyway I hpe this has been of help to you and good luck finding the right person!
Ask them to explain how they learned PHP and what continuous education resources they would recommend to the team.

Ask them what version control software they like best and why.

Sidebar note regarding elvin66 comment on the basic login system.  You can find one here:
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391.html

Best regards, ~Ray
Whatever questions who present them with, ask them to explain their answers.
If you can't explain what you do, you don't now how you do it.
What are the predefined class in PHP
Ans:      Directory
       stdClass
       __PHP_Incomplete_Class
      exception
      php_user_filter

What precaution would you take processing a very big data file
Ans: Must put line like this at the start
        ini_set(‘memory_limit’,’50M’); replace 50M to the values that is appropriate .

What is the difference between temporary cookies and persistent cookies
Ans: When cookie is stored in browser memory and lives till browser is alive its a
     temporary cookie where as if cookies values are in a file in the user system and
     lives till it is deleted is a persistent cookie.

What is type juggling
ANs:Type Juggling in php  means automatically type conversion.

That is to say, if a string value is assigned to variable $var,  $var becomes a string. If an integer  value is assigned to $var, it becomes an integer.
I tend to agree with elvin66...  What you are really looking for is the ability to think and solve problems.  Especially true if you are hiring a junior to mid-level person (you specified 2+ years experience, I believe.)

If you are doing OOP then they should understand how to think in that paradigm.  If you are implementing as MVC then they should know something about that.  Because it is PHP they should understand the implications of loosely-typed languages (.NET developers struggle with that one.)

With Google, EE, etc. it is very easy to become a great PHP programmer if you understand "how" to program.  It then becomes a syntax exercise that most IDEs will help with.

When I interview developers for projects I give them a sample application to design and implement that involves front-end, middle-tier and database requirements.  They are given 20 minutes or so to develop their solution on paper and put it on the white board.  We then discuss what they put on the board in detail and we offer alternatives (some good and some bad) and see how the candidate responds.

The other thing you want to evaluate is their "fit" for your group.  Every team has a culture and you need to make sure there is compatibility.  We've gotten rid of great programmers in the past because they didn't fit into the group for one reason or another.
Thanks Ray for posting a link to a good sample login system, I didn't think to do that. I was assuming the asker would be able to read the written login scripts and follow the logic and security and be able to grade it. For the asker, on the other hand you could reverse the logical test and give them a script for perhaps again a login system and ask them to give you in writing what the script is doing with reasonable detail.

Of course you will already have other pre-employment criteria and the usual security checks etc... but keep in mind that most of us don't like being asked to do to much for an interview so if you make it to tricky or long they may loose interest and you may loose an otherwise good developer. Go for a team player every time!
When I interview developers for projects I give them a sample application to design and implement that involves front-end, middle-tier and database requirements.  They are given 20 minutes or so to develop their solution on paper and put it on the white board.  We then discuss what they put on the board in detail and we offer alternatives (some good and some bad) and see how the candidate responds.

This is the best advice I've seen here.
If you demand answers to very specific questions you are likely to lose site of the fact that very experienced and well-rounded programmers don't necessary know every detail in a specific language. Not even PHP developers do!

But you do need someone who can program OOP, manage sessions, secure user input, query datastores, parse structured text and interface with other languages and server technologies.
I think the question specifically asked for some question that would be asked in a test.
It even asked for answer when someone provided questions only.
If intention was to test a prospective employee question should have been framed accordingly.
ASKER CERTIFIED SOLUTION
Avatar of designatedinitializer
designatedinitializer
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@ designatedinitializer
I entirely agree with you . I am a programmer . I have seen people who have passed
collage certificates in computer programming with very good scores but when it comes
to practical programming they come out a cropper.
And yes i entirely agree no written test will ever gauze capability of a programmer - a good one at that.
But my contention is user who initiated this question specifically asked to provide 3 question
for use in testing prospective candidates and not a way to test a prospective candidates thats all.
Avatar of melwong

ASKER

good
@rinfo
If you'd read this thread carefully, you'd notice that the very first answer was mine, and was a direct answer to the author's question...