Preparing for the Zend Certification
05 Oct 2004In the past week or so, there has been a lot of discussion about preparing for the Zend Certification exam. A common concern people have is whether they can expect to pass it, and this is understandable. Even when you've been developing in PHP for a few years, you may only be familiar with a small subset of PHP's features. Another valid concern is whether the exam asks questions that are tricky or obscure. Some people are worried about missing questions on topics that they understand very well.
For anyone concerned about the presence of obscure questions or the quality of the exam in general, I can tell you that Zend did not create this exam in isolation. They chose an advisory board to establish the target audience, determine the criteria, and write the questions. We all worked together, so poor questions were revised or thrown out before making it to the beta exam. A psychometrician performed a quantitative analysis of the results of the beta exam, and more questions were eliminated as a result of this. Only questions of the highest quality remain, and small improvements not affecting the difficulty of the exam are currently being made. More information about the creation of the exam is available as part of Daniel Kushner's presentation, Attacking the PHP Job Market.
For those wanting to get a small taste of the exam, Zend is offering a self test with 5 practice questions. If you haven't already taken it, go ahead and try it - it only takes a couple of minutes. When you're finished, read below for my comments.
Question 1
What is the value of $a?
<?php
$a = 123 == 0123;
?>
A. True
B. False
I think this question is a bit tricky, because it requires you to realize that 0123 is interpreted by PHP to be the octal representation of 83 due to the leading zero (64 + 16 + 3 = 83). Other than this, the question is good in that it requires you to understand how assignments and comparisons work. The answer is B (False).
Question 2
What is the value of $result in the following PHP code?
<?php
function timesTwo($int) {
$int = $int * 2;
}
$int = 2;
$result = timesTwo($int);
?>
I think this is a very good question. It requires that you understand how functions and return values work. I think any PHP developer wanting to be certified should understand functions very well - return values, passing by reference, passing by value, function local scope, the global keyword, and how all of these things work. In this question, because timesTwo doesn't return anything, the answer is null.
Question 3
The code below __________ because __________.
<?php
class Foo {
?>
<?php
function bar() {
print "bar";
}
}
?>
A. will work, class definitions can be split up into multiple PHP blocks
B. will not work, class definitions must be in a single PHP block
C. will not work, class definitions must be in a single file but can be in multiple PHP blocks
D. will work, class definitions can be split up into multiple files and multiple PHP blocks
This questions requires that you notice the presence of two PHP blocks and recognize that class definitions must be in a single PHP block. My only complaint with this question is that it's difficult for a developer to deduce the answer - it's just something you have to know. On the other hand, the presence of HTML in the middle of a class definition would be an obvious problem, because it makes no sense in this context. I would expect a developer to be able to answer this question correctly, but it might take a few minutes to think about it. The answer is B (will not work, class definitions must be in a single PHP block).
Question 4
When turned on, __________ will __________ your script with different variables from HTML forms and cookies.
A. show_errors, enable
B. show_errors, show
C. register_globals, enhance
D. register_globals, inject
This is not a good question. While the first two answers make no sense, both C and D seem viable, and the difference between the two seems entirely subjective. If you consider register_globals to have a negative connotation, you're more likely to think of its behavior as injecting rather than enhancing. However, I don't think a distaste of register_globals is a necessary characteristic of an expert PHP developer. The answer is D (register_globals, inject).
Question 5
What will be the output of the following PHP code?
<?php
echo count(strlen('http://php.net'));
?>
I like this question. It assumes that you are familiar with the functions count and strlen, but I think this is a safe assumption, and I think it is easy to deduce what these functions do anyway. This question is likely to be missed by the same people who might execute a query that begins with select count(*) and then wonder why mysql_num_rows always returns 1. The answer to this question is 1, because strlen returns a single value - the length of the string.
Hopefully my analysis of Zend's self test gives you a small taste of the types of questions you're likely to encounter on the exam. While I'm just one member of the advisory board, the others tend to share my dislike of obscure questions, and I think the questions that remain are straightforward and well-written.
Zend also has a FAQ available that includes the exam objectives. Use these to direct your studies.
If you're planning on taking the exam, you can save yourself $200 by being the first to solve this puzzle. Zend is offering a free pass to the winner.