About the Author

Chris Shiflett

Chris Shiflett is an author and speaker who leads the web application security practice at OmniTI.


Zend Certification Self Test

In Preparing for the Zend Certification, I provided the answers (with explanations) to the Zend PHP Certification Self Test. Zend has since updated the self test, so I'm again providing the answers to it. Of course, I recommend that you take it before you read this - this is for those who don't understand a particular answer or can't figure out which one(s) they missed.

Question 1

What does <? echo count ("123") ?> print out? 

A. 3
B. False
C. Null
D. 1
E. 0

The answer is D (1), because only a single argument is given to count(). Incarnations of this question typically confuse people due to the fact that count() is almost always used to count elements in an array, so they're not familiar with using it in any other context. Aside from that, it's pretty straightforward.

Question 2

Which of the following snippets prints a representation of 
42 with two decimal places?

A. printf("%.2d\n", 42);
B. printf("%1.2f\n", 42);
C. printf("%1.2u\n", 42);

The answer is B. This question only requires that you remember the basic format strings for functions like printf() and sprintf().

Question 3

Given 

$text = 'Content-Type: text/xml';

Which of the following prints 'text/xml'?

A. print substr($text, strchr($text, ':'));
B. print substr($text, strchr($text, ':') + 1);
C. print substr($text, strpos($text, ':') + 1);
D. print substr($text, strpos($text, ':') + 2);
E. print substr($text, 0, strchr($text, ':'));

The answer is D. The string position of : (the colon) is two less than the string position of the t, so strpos($text, ':') + 2 provides the string position of the t. The substr() syntax therefore says that we want the substring of $text that begins with the t and continues to the end of the string.

Question 4

What is the value of $a?

<?php

    $a
= 123 == 0123;

?>

A. True
B. False

The answer is B (False). This question is challenging, because you must know that PHP treats 0123 as the octal representation of 83 due to the leading zero (64 + 16 + 3 = 83).

Question 5

What is the value of $result in the following PHP code? 

<?php

    
function timesTwo($int)
    {
        
$int = $int * 2;    
    }

    
$int = 2;

    
$result = timesTwo($int);

?>

The answer is null, because timesTwo() doesn't return anything.

Question 6

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.

The answer is B, because class definitions must be in a single PHP block.

Question 7

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

The answer is D. 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'm not sure that a distaste of register_globals is a necessary characteristic of an expert PHP developer.

Question 8

What will be the output of the following PHP code: 

<?php

    
echo count(strlen("http://php.net"));

?>

The answer is 1. This is almost the same question as the first one, so the only challenge is understanding what count() does when given something other than an array.

About This Post

Zend Certification Self Test was posted on Tue, 12 Apr 2005 at 01:50:44 GMT.

172 Comments

1. JD's GravatarJD said:

Other questions are good, but I don't think question 2 and 3 are of any use. They basically check whether someone can remember PHP function syntax which sadly is not consistent.

Anyway, looks like I should try to get the certification.

JD

Tue, 12 Apr 2005 at 02:28:55 GMT Link


2. david's Gravatardavid said:

Is it me, or does C on #6 make no sense? If the code would not work, then the explanation does not make sense. The code snippet (presumably) is in a single file and is in multiple blocks. That satisfies the requirements listed in C and therefore does not explain why the code would not work.

Tue, 12 Apr 2005 at 03:24:33 GMT Link


3. Chris Shiflett's GravatarChris Shiflett said:

C is not the correct answer for question 6. More accurately, it provides the correct answer but the wrong explanation, which makes it an incorrect choice. You're right that it is easily eliminated, however, due to the logical fallacy. That just makes it a bit easier. :-)

Tue, 12 Apr 2005 at 03:47:34 GMT Link


4. Al's GravatarAl said:

If anyone is interested php|architect offers a sample chapter from their book, 'The Zend PHP Certification Practice Book' by John Coggeshall and Marco Tabini. The sample chapter consists of 20 questions (and answers) about PHP Programming Basics. (Chapter 1).

http://www.phparch.com/shop_product.php?itemid=73

Chris, (if I may call you that) thank you for the explanations and the heads up on the new self test questions.

Al

Tue, 12 Apr 2005 at 04:26:11 GMT Link


5. Alec's GravatarAlec said:

I'm embarrassed to say I missed question 6, but I think I can make a pretty good case for answer C.

The statement "class definitions must be in a single PHP block" would seem to imply that you can't do this:

<?php

class Foo {

function bar() {

?> bar <?php

}

}

?>

which you can. I don't really understand how you can say that the "class definition" for Foo in this example is in a single PHP block, and if it's not, then the explanation for B is wrong and C is the best answer, even if C's explanation ("class definitions must be in a single file but can be in multiple PHP blocks") is pretty much irrelevant to the code in question.

I understand that the first block ends and the second begins within a function definition and that's why it's okay, but that doesn't erase the fact that the class definition is in two distinct php blocks. I mean, the class definition starts with the line "class Foo {" and ends with the line "}". Both those lines are part of the class definition, yet they're clearly in two different php blocks. So the statement "class definitions must be in a single php block" is untrue.

Okay, I do protest too much, methinks. What am I missing?

Tue, 12 Apr 2005 at 05:44:08 GMT Link


6. Matt H's GravatarMatt H said:

@Alec:

Although class definitions may be broken within method declarations, C doesn't state this, and so provides us with no reason to see the sample code as incorrect (this is David's point in comment 2). 6.b is incorrect in the big picture, but can provide a reason for the sample code not working.

I think this question could avoid the interpretive problem if 6.b referred to the code sample rather than to classes in general (something along the lines of, "won't work, this class definition is in multiple blocks"). This way the explanation could provide a reason for the code not working without contradicting the manual.

Tue, 12 Apr 2005 at 15:53:35 GMT Link


7. Per Persson's GravatarPer Persson said:

The reason I see for the code in Q6 to not work is that there is some whitespace between the two code blocks. That will be equivalent with an echo statement, which would be disallowed at that position:

<?php

class Foo

{

echo "\n"; // <-- Not allowed here!

function bar()

{

print "bar";

}

}

?>

The same thing happens if you write a switch statement the following way:

<?php switch($var) { ?>

<?php case 1: ?>

...

The output before the case-code is not allowed to be there.

Thu, 14 Apr 2005 at 19:38:51 GMT Link


8. Kristian's GravatarKristian said:

Nice site Chris.

How relevant is question #5 for a certification like this? Yes, I missed it, but I don't think less of me as a php-programmer because of it.

Thu, 14 Apr 2005 at 22:24:15 GMT Link


9. Shaun's GravatarShaun said:

How accurate is this self test. I'm booked right now to take my test in a couple of weeks but I was wondering if the "Self test" covers all areas of the Certification test?

Fri, 15 Apr 2005 at 19:27:18 GMT Link


10. Jim Plush's GravatarJim Plush said:

Number 6 just says the class definition.. you can break in and out of php block INSIDE functions or methods, just not in between functions.

so

<?php

class Foo {

function bar() {

?> bar <?php

}

}

?>

is perfectly fine. because you're inside a method call

Sat, 16 Apr 2005 at 14:55:07 GMT Link


11. Alec's GravatarAlec said:

@Jim

Hate to beat a dead horse, but my point was that the answer says "class definitions must be in a single PHP block," and the class definition in my (and your) example is plainly not in a single PHP block. And it *is* perfectly fine, but it contradicts the statement used to justify 6b, the supposed correct answer.

If 6b had said "will not work, a PHP block cannot end or begin between the functions of a class definition," the answer would be fine. I hear what Matt H is saying, about how the answer should refer to the example instead of making a universal statement (a false one, at that). But even then, if it said, "will not work, *this* class definition is in multiple blocks" as Matt suggests, we can just point to our counterexample and say, "No, actually that's not really why it doesn't work. It doesn't work because the PHP block ends inside the class definition but outside of a member function."

Bottom line: the statement "class definitions must be in a single PHP block" (6b) is false. The statement "class definitions must be in a single file but can be in multiple PHP blocks" (6c) is true, even if it does fail to explain why the code doesn't work.

How can you say 6b, with the false statement, is the correct answer? I mean, being a false statement, it fails to explain why the code doesn't work, too. AND it's false.

6c is the best answer. That's my story and I'm sticking to it.

Sun, 17 Apr 2005 at 06:26:54 GMT Link


12. Al's GravatarAl said:

@Alec

Just to beat the horse again.

I completely understand what you’re saying and do agree with you to a point, but just to argue the opposite view.

The PHP manual states:

"You also can NOT break a class definition into multiple PHP blocks, unless the break is within a method declaration."

So an argument can be made that the rule is: You also can NOT break a class definition into multiple PHP blocks.

And a caveat to this rule is: unless the break is within a method declaration.

I know this is splitting hairs, but could be an explanation for the answer.

Sun, 17 Apr 2005 at 18:46:40 GMT Link


13. Alec's GravatarAlec said:

@Al

<melodrama>Ah, so the PHP manual itself contradicts the explanation for 6b! I stand vindicated!</melodrama>

Powers that be: I submit that 6b should be changed to "will not work, you can not break a class definition into multiple PHP blocks unless the break is within a method declaration."

Mon, 18 Apr 2005 at 00:36:19 GMT Link


14. tepp's Gravatartepp said:

on this self test i had 2 wrong answers and my total score was 6 / 8.

this implies that i was not penalized for wrong answers. does this reflect the true zend php certification conditions ? i.e. when the correct answer is not known for sure is it better to guess or to leave the answer blank ?

thanks for your help,

tepp.

Wed, 20 Apr 2005 at 11:50:43 GMT Link


15. Ryan Wray's GravatarRyan Wray said:

Here is my view on the Self Test, question by question.

1. Bad question. Who passes scalar values to count()? And how would you know the return, unless you were silly enough to pass a scalar value to count() in the first place (or memorize PHP documentation). I suppose, the coding style matches someone who may do that. The code should look more like

<?php count('123'); ?>

2. An okay question. Knowing the rules of the *print_f functions could be deemed important.

3. An okay question.

4. I think the question could of been good if it didn't require the user to know about octal and such. Maybe a simple comparision like:

$variable = 1 == 1;

5. An alright question. Though knowing the return is not highly important, it is I think a good example for new programmers who are learning about functions and returning values. However, for the purposes of an examination, maybe not.

6. Not that great of a question. Who would break up the code in a class anyway and even further to the point who would break it up there, where not even an echo/print statement would be correct. It should instead read:

<?php

class Foo {

function bar() {

?>

bar

<?php

}

}

?>

In my opinion, giving some legitamacy to breaking the code up in the first place.

7. It is an alright question, though a bit subjective as already mentioned. I myself don't really like fill-in the blank questions - sometimes they seem complicated though they are quite easy.

8. Same a question 1, the only thing you have to know is how the count() function treats scalar values: the fact that one is an integer and one is string after that does not matter.

That is my opinion on the questions? Do you agree/disagree.

I have been wrestling with myself to decide if I should take the certification or not. Considering the what I consider the steep price ($200), plus the cost of the Study Guide ($29.99) I decided not too bother. The self-test doesn't encourage me (though it makes me think that the exam would be relatively easy to pass if you have good memory: more so than logic). Also, its popularity so far is quite low. It would be cheaper to take more reconised and respected exam!

I may take it eventually, but I am thinking I won't.

Wed, 20 Apr 2005 at 12:21:58 GMT Link


16. Certify This's GravatarCertify This said:

I agree a lot with "Ryan Wray". I have been a professional php programmer now for about 5 years. I missed 6 of 8. LOL. Yet mysteriously I manage to create good quality PHP code on a regular basis.

I think a solid 'Certification' Question might be where would you find good quality answers to your PHP syntax questions?

I'm not much of a believer in "Certification" anyway. I don't try to memorize syntax as it does change from time to time. I DO however memorize the path to the best documentation.

Just 2 cents worth.

Fri, 29 Apr 2005 at 18:39:18 GMT Link


17. Arnór Heiar's GravatarArnór Heiar said:

I agree with "Certify this". The questions are way too much syntax-centered.

Personally I probably make about a 1000 syntax errors each day and it's not that I don't know how to code, but I make typing errors which I think is completely human :)

In most cases I can't remember the order of arguments, default return values og even function names for that matter.

Tests like this usually don't make much sense, but the way I see it it's a bit lame to be criticizing Chris Shiflett for his test. A test that has the only purpose of preparing people for the actual exam.

Another thing I want to point out is that most certification tests for programming languages are very syntax oriented and usually don't give a very clear picture of the participant's quality of code.

But then again, I'm not a certified php programmer.

Sun, 01 May 2005 at 00:19:31 GMT Link


18. Arnor Heidar's GravatarArnor Heidar said:

sorry about the icelandic letters

Sun, 01 May 2005 at 00:20:21 GMT Link


19. Arnor Heidar's GravatarArnor Heidar said:

I'm sorry, I thought Chris made the test. Should have read better. :S

Sun, 01 May 2005 at 00:28:01 GMT Link


20. Compuchuck's GravatarCompuchuck said:

@Arnor

I know what you mean about syntax errors. My fingers don't always type what my brain is telling them. You may be able to help the cause by getting Zend Studio. The auto-fill of variable names and presentation of function parameters could really help you waste less time correcting misspelled variable names and missing parameters. And the syntax checking will help you not save files that have a syntax error.

To Zend: you can send the commission to my Paypal account. 8^)

Sun, 01 May 2005 at 03:57:30 GMT Link


21. Morgan Craft's GravatarMorgan Craft said:

I have to agree ryan Wray as well. I've been programming with php for close to two years and I only got 3 of the questions right. The first and last one, why would I know what happens when you stick crap like that into count? I've used count several times, mainly for checking the number of elements in arrays, why would I place a string in it? The fill in the blank question about register_global and whether it enchances or injects, wth? Injects? you can kiss my $_POST['a$$']; not taking this cert. =P

Wed, 11 May 2005 at 05:29:56 GMT Link


22. Steven Van Poeck's GravatarSteven Van Poeck said:

If this test reflects the way how the certification tests are run, then I think the certification will not prove much worth.

What is the point of memorizing function syntaxes when they can:

a) change over versions and

b) be consulted in the documentation.

So I mainly agree with Ryan Wray.

A Certification Program can be of help to enhance "professionalizing" PHP in the eyes of decision makers, but the way it is run does not certify that a PHP Certified engineer will write good code...

Wed, 18 May 2005 at 09:53:27 GMT Link


23. Stuart's GravatarStuart said:

To Kristian,

I also missed question #5; however I feel the question is quite relevant...part of our job as programmers is paying attention to details. I, and I'm sure all of us, have encountered bugs in our programs that stumped us because we were looking for something complex when in fact we overlooked something simple!

Wed, 18 May 2005 at 20:29:43 GMT Link


24. ni2k's Gravatarni2k said:

I am php pro for 4 years now. Missed 5 of 8.

Aggreeing with Ryan Wray: If the exam is like this short test, it's not worth anything. It just shows, that there are somewhat silly people, filling there heads with information that haven't to be in their heads as it is in the manual. Good programmers (or the ones I consider to be good) keep their brain free for procedural logic and good design. If our brains must carry all the information found on computers and through the WWW, what are computers and what is the WWW good for?

I - for instance - would have to keep up to 8 laguage manuals in my head, if I followed this approach. My girlfriend would be discouraged, cause there wouldn't be any place left to "save" her name or birthday.

I think keeping your mind free of manualdata is worth more than some exam no one really needs to be a good programmer.

Thu, 19 May 2005 at 12:55:27 GMT Link


25. Hamad's GravatarHamad said:

it seems like good overview for the exam, it gives you an idea where you are standing in php coding :)

Sun, 22 May 2005 at 05:42:37 GMT Link


26. Haseeb's GravatarHaseeb said:

I think it is a nice effort to make oneself familiar with the Zend PHP test. Although questions were quite different and were nicely organized, i think atleast an experience of 4 months in PHP development will be necessary for appearing in the test.

Mon, 23 May 2005 at 08:12:25 GMT Link


27. Paulo's GravatarPaulo said:

I´m with ni2k when he says we dont need to keep all the syntax inside our brain.

If I did that, I would be like an encyclopedia with all that data... thats what manuals are made for.

Good programmers knows the logic and can implement it in wichever language they need to...

[]s

Paulo

Mon, 23 May 2005 at 16:50:50 GMT Link


28. Artyom's GravatarArtyom said:

PHP pro for 5 years, missed 4 of 8. There's something not right with these tests - they all claim to reflect real world hands on experience, and instead they focus on the syntax and odd function calls like count("blah"). If someone would ever want to know what would this strange construct return, he could type that in and see, eh?

I will consider taking this exam, but combining its price and its uncertain value in regards to the exam content, I'm hesitating.

P.S. Used to pass the Brainbench PHP Master certification program with a top score in their listing, and didn't bother to retake the exam when the cert expired. The reason is the same - synthetic tests have little real world meaning, but sadly, they seem to convince employers (probably for the lack of other reasonable means).

Artyom

Wed, 25 May 2005 at 02:58:34 GMT Link


29. Jaygiri's GravatarJaygiri said:

Only 3/8 :(

But it teach me that I should remember the era when there was no code hints are available. And I should remember common function and its CURRNET syntax. I should not forgot the funda of PHP (and C). If I am opening manual every time for syntax of common code I should not call my self Pro!

Anyway Hasitating Test! NO?

Wed, 25 May 2005 at 07:10:14 GMT Link


30. Conrad's GravatarConrad said:

Hi, I'm very new to PHP and I'm in the process of learning it. Anyway, I was able to get a 1 out of 8. In any case, I will give myself several months before I consider taking the exam and I would like to wish everyone the best of luck with the certification.

Peace,

-Conrad

Thu, 26 May 2005 at 02:20:37 GMT Link


31. Dhiraj Patra's GravatarDhiraj Patra said:

As I am a software engineer and developer, very much fond of PHP. It is a very good test. But I thing nor text written answer should not be there. As Q-5. answer can be given 'nothing' instead of null because null is not equivalent to nothing and here most appropriate answer would be nothing not null. best regards.

- Dhiraj

dhiraj.patra@rediffmail.com

http://www.sonty.co.nr

Sat, 28 May 2005 at 05:19:37 GMT Link


32. Thomas Gruner's GravatarThomas Gruner said:

Wow! Missed 5 out of 8. I have stuck to writing my classes without trying to echo "Hello world" in the middle... and I don't use the count function on strings. But, hey I can start echoing things in my functions and using count on strings. Just give me the pretty certification. Octal 100%!

Mon, 30 May 2005 at 10:24:53 GMT Link


33. BrijKumar's GravatarBrijKumar said:

it is very logical question.a people who have deep knowadge about php he can solve it.

I request to plz you send more question like this

Tue, 31 May 2005 at 06:18:12 GMT Link


34. anon's Gravataranon said:

I've programmed about 250 lines of PHP over the course of 1.5 years. I got a 6/8. I missed #3 and #5. I should have known better on #5, because it's general C-style programming.

I won't be getting certification, but I will be learning more PHP.

Wed, 01 Jun 2005 at 07:54:57 GMT Link


35. ccp's Gravatarccp said:

I write decent code for my limited php experience. I have sound programming principles from studying other languages and PHP enables me to do things with stateless http that I could only dream of previously.

I got a 2 out of 8. I'm not ashamed to used the ref manual when I have to. Do u know why? Because anyone who passes by my PC says that the code looks like an asain language and to me it makes perfect sense.

I don't have to be labeled pro. Anyone who programs is forever a student.

Wed, 01 Jun 2005 at 08:21:31 GMT Link


36. Shurik's GravatarShurik said:

Q7 seems to be the worst question because of the "enhance" vs "inject". If one of these dodgy choices removed, Q7 potentially could be the best question as it does not test the syntax but the PHP knowledge.

I'd suggest logical sections in the test. Not all questions shall be syntax related or test the memory of the function help.

Where the purpose of the test is not to check the rough memory but the developer logic and engineering skills, I would suggest printing the short standard function description next to the question where it is used.

Fri, 03 Jun 2005 at 03:47:25 GMT Link


37. incous's Gravatarincous said:

Well done, you will be the master of PHP when do the perfect.It's not too difficult but you have to learn all of PHP (even tiny things)

Fri, 03 Jun 2005 at 03:55:06 GMT Link


38. Karolis Tamutis's GravatarKarolis Tamutis said:

I'm somewhat dissapointed with the questions. Got 6 out of 8, also missed 5th (hey, it's 5 AM here), but I was hoping to see more OOP / app design type questions. As someone mentioned, memorizing function parameters can't teach you to code better.

Mon, 06 Jun 2005 at 01:58:05 GMT Link


39. Phu's GravatarPhu said:

Honestly, come on. I came across something about Zend PHP certification and thought I'd check it out... there's absolutely no way I'd pay $200 to be asked asinine questions about outdated functions and the results of poor programming practices.

I've been writing PHP applications with mySQL back ends pretty much exclusively for about three years now... and I managed a 2 out of 8. If this is how Zend tests programmers, I am truly confused as to how the language is still alive.

Mon, 06 Jun 2005 at 05:55:14 GMT Link


40. Klaus's GravatarKlaus said:

i do php coding for about 3 years now and when i first tried this self test i *shame* missed 5 questions including the two with the shitty use of the count() function.

Did one of you try the brainbech PHP exam? It's a bit tougher than this self test, but its worth taking it to see how mean questions can be ;-).

I think the focus of the php certification should be on debugging skills instead of plain syntax checking like some of these questions.

BTW: i try my cert exam at the end of this week.

Mon, 06 Jun 2005 at 17:39:51 GMT Link


41. XAnkth's GravatarXAnkth said:

I'm afraid I agree with what most people are saying here. Memorize-this-syntax exams have been recognized as a bad way to test *anything* for a long while now. You guys really need to update this exam (or just these sample questions).

Sat, 11 Jun 2005 at 06:43:21 GMT Link


42. Yurgh's GravatarYurgh said:

Scored 3 of 8 with 5yrs experience ;)

Most of these test questions doesn't really reflect "real life", as most of the code doesn't make sense. I can honestly say I've never count'ed a string, and I don't see myself doing it in the near future. :)

However, having a certification to show for is (usually) excellent for job interviews or getting a raise. Since most executives have absolutely no idea on what you're really doing - just about any framed certificate will do.

So, I'll be getting the Zend self-study-book, and brush up on unlikely use of PHP to get this on the wall :)

Sat, 11 Jun 2005 at 13:20:32 GMT Link


43. red's Gravatarred said:

uhm, 6 years professional practice, several complex projects (e-learning plattforms, custom made content management systems, etc) a year... and got only 2 of 8? hm, well, I just never bothered to learn all the syntax-details by heart. php.net has a great documentation... so, why should I? just to get the certification?

Mon, 20 Jun 2005 at 08:24:48 GMT Link


44. Jon's GravatarJon said:

I'm BRAND new to PHP, the only thing I know is the echo statement! Still I got 2/8 right, same as some old pros! It's encouraging.

Thu, 23 Jun 2005 at 00:47:09 GMT Link


45. Stefan's GravatarStefan said:

Hi,

there is a syntax error in question 3/ option E.

A right parenthesis is missing.

Is this done by purpose to make the test even harder or is it just a slip of the pen?

Cheers

Stefan

Sat, 25 Jun 2005 at 09:28:12 GMT Link


46. ekt's Gravatarekt said:

Reading some comments here, people seems to be disgusted of passing a string to the count() function. Of course, no one would normally do it. But I can imagine trying to hunt a bug in a code where some variable, expected to be an array, happens to be a string when calling the count(). I'd consider myself a more effective programmer knowing what the return value is in such a case. This and other tricky questions like this are not that far away from real world.

Sat, 25 Jun 2005 at 19:37:13 GMT Link


47. Chris Shiflett's GravatarChris Shiflett said:

Stefan, I've corrected it. To answer your question, no, there are not questions that are that tricky. However, I personally think that there is a great deal of value in being able to quickly identify such an error.

Sat, 25 Jun 2005 at 21:40:13 GMT Link


48. Harshit Sekhon's GravatarHarshit Sekhon said:

Hmmm ... interesting set of questions. They make you wonder, "what on earth have you been writing those thousands of lines of code per application for when you can't answer basic syntax questions". :)

As for Q1. I wonder why php sees a string literal as a single argument when passed to count when the same literal assigned to a variable is represented somewhat like an array. Remember the index based access of string elements? Weird huh?

I am seriously considering taking the test, but whoa! would you look at the exam fee and the books' prices. Aren't there pdf-only versions which can be sold cheaper or maybe even EEE's (Eastern Economy Edition). Thats 8,600 INR for the exam + 2300 INR for the 2 recommended books (approx). So I guess I'll have to put it off until the exam is more recognized or until the time I have enough to spend on something like this. :(

Tue, 28 Jun 2005 at 21:15:35 GMT Link


49. Alex's GravatarAlex said:

I'm pretty sure answer three is valid for question three as well. I pasted the code into a PHP page:

--output--

Content-Type: text/xml

ontent-Type: text/xml

text/xml

text/xml

--/output--

Looks to me that both C and D are valid.

Tested on PHP Version 5.0.4 :)

Wed, 29 Jun 2005 at 11:34:01 GMT Link


50. Naif Meelbi's GravatarNaif Meelbi said:

Hi, I got 6, I think it`s good from me. But I did not find the enough answer but, finally, I know why the answer is.

Anyway, (En Shall Allah) I will take The Certification.

I am looking for the best place to get it in my country (KSA)

bye

Sat, 02 Jul 2005 at 20:32:33 GMT Link


51. DiZpel's GravatarDiZpel said:

Alex:

Both C and D seems to be correct because the extra white space is stripped. C returns ' text/xml', and D returns 'text/xml'. This means D is correct, and C isn't.

DiZpel

Tue, 05 Jul 2005 at 09:35:25 GMT Link


52. Praveen Kumar M [INDIA]'s GravatarPraveen Kumar M [INDIA] said:

This sample test helped me to test myself in PHP.

Thu, 07 Jul 2005 at 04:29:02 GMT Link


53. moh bahdoon's Gravatarmoh bahdoon said:

I agree most of the comment writers. Particularly, those who wrote that self-test is very much syntax oriented and does not test the professional and good quality of PHP.

Thu, 07 Jul 2005 at 16:43:20 GMT Link


54. Nermin Hanjalic's GravatarNermin Hanjalic said:

I totaly agree with JD, the questions 2 and 3 simply does nothing to do with reality!

I have 6 years of webprogramming experience an i dealing all the time with actionscript, java, mysql, access, xml ,php ... and i SIMPLY DO NOT ALLOW to myself to memorise all that stupid stuf like all this output-formating, dates parameters etc. If i need it ill look in the ref. I mean what for r the references for? Remembering the stuff like that ist just LOOSING THE TIME. And by the way(laudation not intended) i'm Certified Flash MX Developer,

Certified MySql Core Developer,

Sun Certified Programmer for Java 2 Platform 1.4,

and on none of the exams above, i found questions like that.

But i liked the other once particularly Q. 4 and 5 .

Thu, 07 Jul 2005 at 19:14:37 GMT Link


55. dEEPS's GravatardEEPS said:

hi all,

i just missed ques 5. I was half right. I knew the function didnt return anything, but i thought the answer would still be 2, rather than null.

all the best to all of u for the actual certification.

regards,

[dEEPS]

Fri, 08 Jul 2005 at 01:50:37 GMT Link


56. CK's GravatarCK said:

I think you 'pros' don't understand the purpose of some of these questions. I got 7/8 (missed the octal one) and had never put a string in 'count()'. I used LOGIC to understand that the count would be 1. They ask questions that you do not know the simple syntax for so that you have to think about the way PHP handles types and actually derive how things work. Perhaps many of you do not have computer science degrees and are simply programmers, in which case it is understandable. It is also understanable that Zend does not want to certify you as 'elite'. I'm not trying to insult programmers or technical institute graduates, I'm just saying that comapanies want the certifications to hold merit, and since they cannot review your code, they ask questions that require a thought process where the most logical answer is derived, which requires more indepth knowledge than syntax and HTML forms

Fri, 08 Jul 2005 at 05:25:01 GMT Link


57. PATTERSON's GravatarPATTERSON said:

"Alex writes:

I'm pretty sure answer three is valid for question three as well. I pasted the code into a PHP page:

--output--

Content-Type: text/xml

ontent-Type: text/xml

text/xml

text/xml

--/output--

Looks to me that both C and D are valid.

Tested on PHP Version 5.0.4 :)"

Can you verify that it didn't print out '{space}text/xml'?

Wed, 13 Jul 2005 at 07:13:08 GMT Link


58. FM's GravatarFM said:

null is not strictly the right answer to question 5. If function does not return value, the variable will not be set at all. Call isset() on $result and see it yourself!

Interestingly, is_null will return TRUE on the variable, which is not set but direct check with === operator will show that variable is NOT null!

Mon, 18 Jul 2005 at 06:25:35 GMT Link


59. premlal's Gravatarpremlal said:

This test is worthfull for checking the knowledge

base. But for any programmer the primary thing needed is logic.

This test is very good enough for freshers. experienced guys may be unaware of some syntax.

premlal

Tue, 19 Jul 2005 at 14:14:13 GMT Link


60. karlosprog's Gravatarkarlosprog said:

beleza galera, tô começando agora com php e confundi a cabeça com 3 questões, mas as outras 5 acertei blz.

Fui.

Sat, 23 Jul 2005 at 20:39:40 GMT Link


61. Junior's GravatarJunior said:

Acertei 6/8, teve uma que coloquei false, mas era null, foi a que a funcao nao tinha result, foi falha minha.. o jeito é prestar mais atenção..

Sat, 23 Jul 2005 at 23:43:44 GMT Link


62. cdanea's Gravatarcdanea said:

Well... I was very interested in the certification, but very dissapointed by the test sample. I've been working with PHP for 5 years now, writing proffesional applications, and although got 7/8 (missed the octal one), I must say that I am skeptical about my chanses of taking such a test.

I used common sense for anwering most of the questions, and common sense is not a good foundation for getting a certification. I will not spend all that time and money to read the reference books, since I'm expecting a refurbished reproduction of the manual for those "really important" aspects that are "relevant" for this test.

I was seriously looking for information about the certification, but my curiosity fot this test saved me. I'm sure that this sample test has changed a lot of people's intentions about getting certified. You should consider removing this page from your certification marketing area of the site, because you are actually losing customers.

Sun, 24 Jul 2005 at 10:25:56 GMT Link


63. cdanea's Gravatarcdanea said:

PS I was curious on how many people actually did get the certification...

154 Americans (employers there really love cretifications)

50 Germans !?

24 from the UK

9 French

1 Indian !? - indian developers have a very large share of the PHP application market (in Europe especially), and are highly regarded for their expertize and professionalism

Sun, 24 Jul 2005 at 10:40:32 GMT Link


64. Caloã�'s GravatarCaloã said:

Teste ínútil.

Não quer dizer nada na programação.

Esse tipo de pegadinhas são descobertas fácil quando você está programando.

Ínútil test. It does not want to say nothing in the programming. This type of errors is discovered easy when you are programming.

Tue, 26 Jul 2005 at 22:04:57 GMT Link


65. mano's Gravatarmano said:

Hey,

Yes, this selftest is useless. It may tell you that you are ready if you had luck and tells you are stupid even if you develope pro stuff.

I know my level and it is not beginner, but I have never tried count() with nonarray and even if I do read manuals a lot, I didnt notice that. Someone mentioned that it should be known, caz yes, If you passed somehow a scalar value to the count you may notice the bug by always getting 1 as result.

The function with the null is also good to know. Someone said that it is not null because it is not set by isset and the $result===null does not work. For those: Read more manual, this was for you. Not set variables return NULL by default and

$set=null; $is_set=isset($set);

will make $is_set false because that is the definition. Zend engine or whatever, it is said so in the manual.

Methods with no return also set the variable to null.

To make summary, I think this 8 question tried to encourage people trying the test. If you check the list of required knowledge, you will notice that you supposed to know everything. Sure, If I would hire someone and I filter the candidates by a certification, I want the certification to ensure the quality of the programmer. So probably in a couple of year this 'paper' will worth some.

There is a book recommended in one of the posts, the example chapter contains some 'real' examples for the exam. Those are cool, because if you know whats going on, you sure what to answer.

http://www.phparch.com/cert/ZPCPB_sample.pdf

Makes more sense...

Anyway, It is expensive for me to take at the moment, so I probably will delay it, but wont forget about it.

Zend: Take this self-test down as soon as possible caz you are losing your future certificated programmers and with this meanless 'test' you slow down the process of an exam what should be wide-spread.

Why do I say this? Is there any of you who lost job/project of a programmer who worked for less or ask for less? Do you ever felt that the client will never see the difference between quality stuff and crap?

They should have come up with this earlier!

Take care!

.mano

Wed, 27 Jul 2005 at 19:41:44 GMT Link


66. André Luiz F. Rodrigues's GravatarAndré Luiz F. Rodrigues said:

Very very good test... in Brazil have 3 certifield guys... i expect to be the next!

Any questions really are confused, but if analise well get answer without problem!

Thu, 04 Aug 2005 at 02:59:18 GMT Link


67. simon's Gravatarsimon said:

I&#8217;m curious about the perceived value of being Zend Certified. The questions seem to be based on memory of the PHP manual, what is the real world benefit of this?

When developing you typically -have access to documentation and the ability to view output directly, why bother to commit obscure facts to memory? A more appropriate form of certification would include design considerations, which are key to developing robust PHP applications.

Fri, 05 Aug 2005 at 12:46:41 GMT Link


68. Arnold Smyth's GravatarArnold Smyth said:

I answered FALSE for question 5 and was given an incorrect. If you evaluate the variable for FALSE or NULL you will find that it can be either.

Tue, 09 Aug 2005 at 12:05:22 GMT Link


69. chris's Gravatarchris said:

function timesTwo($int)

{

$int = $int * 2;

}

$int = 2;

$result = timesTwo($int);

arg, i answered 4, damn perl!!

Funny, when i first heard zend was doing a PHP cert, I naturally assumed the PHP manual would be available for it, since the biggest distinguishing factor i've noticed over the years between good php programmers and bad php programmers is ability to consult the manual when necessary and use it effectively

Thu, 11 Aug 2005 at 06:20:05 GMT Link


70. Aaron's GravatarAaron said:

The PHP Manual is not availiable during the test? That is the trouble with these tests. Who codes without a computer? I usually use a computer to do my coding, and on my computer I have the PHP manual.

I don't understand question 7 . What does

"When turned on, register_globals will inject your script with different variables from HTML forms and cookies." Mean?

Fri, 12 Aug 2005 at 05:17:01 GMT Link


71. KVJ's GravatarKVJ said:

If Zend certification means distingusing good PHP programmer, then these set of questions do not make much sense, as these questions probably test the debugging skill not the logical and analytical skill of programmers, because in real life no one will intentionally write count("eerer") and check what will be output.

Also about remembering the syntax is concern, may I know is there someone who remembers all PHP or any other language syntax?

I would love to see questions in test, which reflect a good programmer logical skill in PHP.

Sun, 14 Aug 2005 at 04:02:23 GMT Link


72. Albert's GravatarAlbert said:

I have been using PHP for the last three years (almost exclusively) writing rather complex web applications with it.

What I have found is that I extensively use the manual as a reference for syntax. Even when programming in C or Delphi/Kylix I use the manual.

Taking this self test, I though that it would test my general knowledge about PHP. Surprisingly it tested me for syntax.

Wouldn't it be better to test knowledge sound programming priniciples?

I would like to know how regular expressions work, how to interface more with the operating system, etc.

I liked the Octal question (#4) and the one on the classes (#6).

Testing if I know the syntax for count() is stupid. If I want to know the length of a string I use strlen(). If I want to know the number of elements in an Array I use count(). If I'm not sure I use the Window CHM manual as it is searchable.

I do hope that the ZCE qualification exam is not as stupid as this self test. If it is, then I cannot see any reason why I should rather hire a ZCE qualified person than someone who is not ZCE qualified.

Wed, 24 Aug 2005 at 07:37:05 GMT Link


73. Streaky's GravatarStreaky said:

Question 1, 2 & 8 are silly / pointless, the rest are very basic - most people with a little knowledge of php should be able to answer them.

Therefore they tell you nothing about the person that took the exam, so I won't be bothering.. not yet anyways, I'd rather let my experience do the talking.i gni

Wed, 24 Aug 2005 at 18:30:19 GMT Link


74. Seba's GravatarSeba said:

I am a PHP developer for over 2 years now. Coming from JSP, I found PHP a very simple to learn language, very well supported and documented.

I understand that PHP is a Rapid Application Development Language, but considering yourself a professional based on memory is a big mistake.

A true WEB developer, must be well educated and experienced in WEB applications design, approaching the right way the clients specifications and finally producing a solid, scalable and secured (which is the most important issue) application, that wouldn't let the client out of money or confidential data because of some security hole and that would give future developers a core to build on new features easily.

If this set of questions reflects the real test level, than any "professionals" who own ZEND CERTIFICATES, must know that the certificate shows they're ability to create a guestbook or a contact form without consulting the manual (than why does it exists?)

I got 4 questions, but I don't feel bad about it.

I just don't consider this test PHP relevant, otherwise why did they worked so hard on the ZEND2 Engine? not to create a much more powerfull language out of php? Understanding this new features (OOP support), and what developemnt posibillities they open is the stuff that should be tested.

Cheers

Thu, 25 Aug 2005 at 13:18:01 GMT Link


75. JamesBenson's GravatarJamesBenson said:

Personally I cant see how I was supposed to know the answer to the questions about the count function, ok im no expert but without sticking count('123') into a file and running through PHP im not gonna know because I already know count() counts array alements and strlen counts string lengths so would notice this is wrong as I did and it takes an array as argument but never tried to stick some numbers in just for the sake of seeing whats returned.

Tue, 30 Aug 2005 at 20:31:09 GMT Link


76. JD's GravatarJD said:

Oh dear :( 3 from 8

Just for the hell of it I decided to try this test. 2.5 years php coding moderatly difficult web applications. I would not say I 'know everything' but believe I have a damn good knowledge to put a decent site together.

I just memorise where the best documentation is and where the best help can be found. Perhaps I should remember all the syntax and forget the wifes birthday.

Thu, 08 Sep 2005 at 13:07:21 GMT Link


77. bob kennedy's Gravatarbob kennedy said:

So question #1 doesn't require a semicolon?

Wed, 21 Sep 2005 at 18:07:44 GMT Link


78. Sean Benoit's GravatarSean Benoit said:

Thats correct...question 1 doesnt require a ; .... People getting "butt hurt" (quoting chico) because they missed a couple "easy" one's?

Sun, 25 Sep 2005 at 18:55:21 GMT Link


79. Siva Prem's GravatarSiva Prem said:

<?php

function timesTwo($int) {

$int = $int * 2;

}

$int = 2;

$result = timesTwo($int);

?>;

Question 5 :

Was every fast in answering this, and gave wrong answer as ";". (check the last ";" in the question, which mislead me and forgot what question was :) ).

Wed, 28 Sep 2005 at 01:29:49 GMT Link


80. Brandon's GravatarBrandon said:

nice, pretty test.

Thu, 29 Sep 2005 at 07:04:46 GMT Link


81. Josh Fox's GravatarJosh Fox said:

I have been programming with PHP exclusively for 4 years now and feel that I can make it do anything, although I only got 2/8 questions correct. With PHP you are always learning and improving you skills. The test is fine, but any practice test for any cert is always book oriented and not real life in comparison.

Fri, 30 Sep 2005 at 17:43:08 GMT Link


82. Pepito Grillo's GravatarPepito Grillo said:

Yeah, no. 2 and 3 are not really to be included in a certification exam, since in real life you always have the PHP Manual at hand. Maybe it will take you two or three attempts, but you will find the way after all...

Fri, 30 Sep 2005 at 23:13:56 GMT Link


83. Scoobs's GravatarScoobs said:

Je programme depuis au moins 4 ans avec PHP, j'ai l'impression que je peux faire ce que je veux avec PHP mais comme je n'ai jamais fait de cours d'informatique de ma vie, je me disais que je pourrais faire valider mes connaissances avec cette certification.

Erreur !!! 0/8 ! Mais bon, quand je code, je ne fais pas des count() sur tout ce qui passe pour voir ce que cela donne. Et puis franchement, pour moi, une des plus grandes forces de PHP, c'est php.net (ah... si seulement mysql.com était aussi bien fait !).

Thu, 20 Oct 2005 at 18:49:45 GMT Link


84. Darkwing's GravatarDarkwing said:

Details are a programmers live and they should be given great attention. Knowing the syntax rules of the language you use are the base for a good programmer.

This certification is not here to test if you are a great programmer or if you've got the correct coding style. It is here to test your knowledge of php. I never programmed in PHP (except for "Hello world") before, but I missed 3 because of my insufficient knwoledge of the php syntax.

That is how it should be.

You should be able to program a compleet piece of code, after approx. 2 years, without using an ide and know that your code is right. This wont be achieved if do not know about the php syntax.

Darkwing

it's better to loose oneself then to loose but a minor detail

Mon, 24 Oct 2005 at 14:59:34 GMT Link


85. kk's Gravatarkk said:

It seems the test of memory and experiance rather than logic and talent. There can be better questions like #3 for the experienced people.

Fri, 28 Oct 2005 at 07:30:49 GMT Link


86. cberry's Gravatarcberry said:

Closed book just doesnt make any sense. Being able to use to PHP manual correctly and efficiently is every bit as important to a programmer as memorizing reems of methods.

I dont have a problem with the questions as such (testing genuine programmimg ability in this way is difficult), just the fact you cant use textbooks/ the net to help you answer them.

Tue, 01 Nov 2005 at 12:39:06 GMT Link


87. Bryan King's GravatarBryan King said:

There is a typo on Question #5

The code is:

<?php

function timesTwo($int) {

$int = $int * 2;

}

$int = 2;

$result = timesTwo($int);

?>;

This code returns a Semicolon on the page. Not Null.

Thu, 03 Nov 2005 at 20:28:25 GMT Link


88. Bryan King's GravatarBryan King said:

Duh, I misread the quesiton. LOL. That got me.

Thu, 03 Nov 2005 at 20:29:17 GMT Link


89. Dharmendra Ajwani's GravatarDharmendra Ajwani said:

I think , syntax does play a good role in life of Programming Expert. But logic is important too. If you know the syntax but have no logic you cant do anything. But if you dont know syntax but you have logic you can some how manage, as syntax you can get from net or manual's but you cant get logic from anywhere.

Ajwani

Fri, 04 Nov 2005 at 05:12:02 GMT Link


90. John-Henrique F. Silva's GravatarJohn-Henrique F. Silva said:

Gostei do teste, muito preciso porem sao poucas as questoes apresentadas...

Tue, 08 Nov 2005 at 23:26:04 GMT Link


91. Ralph Almeida's GravatarRalph Almeida said:

manero o teste, ate q fui bem =]

kem sab nao tento a certificação!

Wed, 09 Nov 2005 at 16:05:17 GMT Link


92. Michael Drinnan's GravatarMichael Drinnan said:

Sadly I only got 3 of the questions right, but I am very interested in PHP. Will Continue, thnx.

Wed, 09 Nov 2005 at 19:21:01 GMT Link


93. Noel's GravatarNoel said:

Q4 is BS:

~ # php -r "$a = 123 == 0123;"

Parse error: parse error, unexpected '=' in Command line code on line 1

WTF, you can't do that...

7/8 for me...got 6 wrong cause I never thought to do something so dumb.

Fri, 11 Nov 2005 at 02:43:02 GMT Link


94. Chris Shiflett's GravatarChris Shiflett said:

Noel, you might want to make sure you're right before you call something BS. :-)

That's perfectly valid syntax. Your method of testing is flawed. I'll let you figure out the rest.

Fri, 11 Nov 2005 at 04:23:18 GMT Link


95. Fat Albert's GravatarFat Albert said:

I'm fat. You all suck. Lets do lunch.

Fri, 11 Nov 2005 at 13:44:10 GMT Link


96. Rui Gomes's GravatarRui Gomes said:

This is a good test, i belive it tests the developer from an engineering standpoint, testing the student for profound knowledge of the language. Secure and advanced applications are not built with simple sintax knowledge, and you wont allways be working over your own code.

You shouldn´t get the certification if you are thinking in developing web forms and simple applications.

I´m taking computer science and got 2 out of 8. I have been working with php for 5 years and this result will change the way i use the php manual.

Best regards from portugal (2 ZCE´s)

Rui Gomes

Tue, 29 Nov 2005 at 22:11:49 GMT Link


97. Christopher kalu's GravatarChristopher kalu said:

Hey Stefan the missing parenthesis from Question 3 is at the end of Question 5

What is the value of $result in the following PHP code?

<?php

function timesTwo($int) {

$int = $int * 2;

}

$int = 2;

$result = timesTwo($int);

?>;

Wed, 30 Nov 2005 at 22:14:53 GMT Link


98. WP's GravatarWP said:

I dont's think q2,3,6 were useful....

Anyway I will get the Certification

Thu, 08 Dec 2005 at 14:04:37 GMT Link


99. Prabir Dutta's GravatarPrabir Dutta said:

I didn't understand the part where leading zero in any number can format is treated as octal number in PHP, i didn't find the same.

Mon, 12 Dec 2005 at 13:00:31 GMT Link


100. Bharathiraja's GravatarBharathiraja said:

Hi,

I got 4/8.

I am working php in last 6 months. I am interesting to write the zend certification exam. The practice exam is very well, that is used to improve my skills and also i think i know only the little bit in php. Afterthat I hardwork to learn more about PHP and I would like to attend the zend certification exam. This certificate is very near by me.

Tue, 20 Dec 2005 at 10:30:15 GMT Link


101. Madhur Kumaria's GravatarMadhur Kumaria said:

I am working php in last 7 years. I am interesting to write the zend certification exam.

Its was a nice self test in which i scored 7 out of 8, so I think I must go for this exam.

Thu, 22 Dec 2005 at 12:56:08 GMT Link


102. Vitas's GravatarVitas said:

Yahoo! 8 of 8! I'm good!

Mon, 26 Dec 2005 at 07:24:59 GMT Link


103. Sudhir Chauhan's GravatarSudhir Chauhan said:

i got 8/8....

:-)

Enjoy

Tue, 27 Dec 2005 at 13:38:55 GMT Link


104. PUNEET's GravatarPUNEET said:

I HAVE GOT 3/ 8 SO I HAVE TO DO LOT OF HARD WORK.

Thu, 29 Dec 2005 at 00:18:44 GMT Link


105. Alex's GravatarAlex said:

All of these questions have absolutely no sense for real php-development.

Thu, 29 Dec 2005 at 17:04:21 GMT Link


106. ashish's Gravatarashish said:

i got 6/8 i will try to get 100%

Tue, 03 Jan 2006 at 12:35:11 GMT Link


107. guest's Gravatarguest said:

ashish, I know you executed code locally and got the 6/8

:)

Try to get 100% but without cheating...

Tue, 03 Jan 2006 at 13:03:25 GMT Link


108. K Therrault's GravatarK Therrault said:

I am simply amazed at the negative comments coming from all of the people who crapped out on this simple little test. I have been programming using PHP for about a year, and right off the bat, I got 6 of 8 of the questions by simply evaluating the questions logically.

Come on people, this was pretty simple stuff really, putting down and flaming a certification exam because you do badly on it is very childish and highly unprofessional. If a person does poorly on an exam, would they not be eager to study harder and re-take the exam until they passed? My suggestion is to read the questions thoroughly, they all make perfect sense if you read them correctly.

Personally, I think the ability for one to know a language inside and out, and understand even the most obscure and miniscule functions and constructs is very important in the real world. If I were hiring someone to build an enterprise level PHP app, and they couldnt answer a few simple easy to understand questions about the language the application was being written in, would I hire them to build tha application?

Probably not. Would you?

Plain and Simple.

This is just one mans opinion...

PHP rocks!

Wed, 04 Jan 2006 at 03:18:25 GMT Link


109. Doesnt Know PhP at all's GravatarDoesnt Know PhP at all said:

Its funny that people are acting like this is the first test ever for a computer language. I passed the java one way back like 8 years ago and its all the same arguements. All certifaction is for is so you can say "Look I actually know some of this" its not to say how good you are at it.

And BTW I have never programmed in PhP and I got 5 out of 8. I was looking for the pass mark to the exam as my brother is taking it.

Fri, 13 Jan 2006 at 03:27:35 GMT Link


110. Rocky's GravatarRocky said:

Well... I got 6/8...

But are this questions really on the _exam_? I mean these have nothing to do with real php programming. Well sort of.

I'm just interested if this self-test is relevent or are the questions (as were cases in other exams :P) on the exam harder?

Hope somone could be so nice an give an answer. Thnx!

Cheers!

Mon, 23 Jan 2006 at 12:44:23 GMT Link


111. Dhanasekar.G's GravatarDhanasekar.G said:

I HAVE GOT 4/ 8 SO I HAVE TO DO LOT OF HARD WORK.

Wed, 01 Feb 2006 at 11:21:25 GMT Link


112. Mike Walters's GravatarMike Walters said:

I've been coding PHP for over 10 YEARS (since the very first release of PHP/FI back in 1995).

While I faired ok on these practice questions, like most of the other veterans who've posted comments, I don't see much use for them. Why would a professional ever type (as seen in Question #8):

echo count(strlen("anything")); ?

I guess it could be a cool covert way to echo the value 1. Of course, so is echo chr(49); or echo similar_text("x","x"); or worse echo strlen(strlen(trim(substr(bin2hex(ereg_replace(strtolower(ucwords("bar")),"foo","bar")),0,3))));

But why in the world would I ever do this? I think I'd probably just type echo 1; :/

And if, FOR EXAMPLE, I was cleaning up code behind someone else and I saw something like this, I would probably just giggle and re-write the whole prog.

A good profiency in the language is what they're attempting to test for, but I think it's obvious that no serious programmer is going to remember what the 3rd arg for html_entity_decode() is. And therefore, these types of questions seem somewhat meaningless to real professionals.

I'm considering doing some certs and this was one of the certs I was interested in. While I'll probably still get the cert, I have serious concerns about what the certification certifies. It looks to me like a ZCE is basically a master of the ZCE exam as opposed to actually having a working knowledge of the language. I hope someone will help ZEND rewrite the exam to be a little more practical and professional.

I have a quick practice exam for ZEND:

Q1: What would the following question prove?

"What would the following produce?

echo strlen(strlen(trim(substr(bin2hex(substr_replace(strtolower(ucwords("bar")),"foo",0),0,3))));"

ANSWER: Nothing. Don't ask a dumb question on a professional exam.

What's my idea of the ideal exam, one might ask? How about a series of scripts to perform certin tasks. Give the programmer a certain amount of time and all the resources of the Internet and documentation and ask him/her to program 5-10 scripts which challenge his working knowledge of the program. Results are graded on efficiency and optimization.

Sat, 04 Feb 2006 at 21:23:27 GMT Link


113. hafizan's Gravatarhafizan said:

I code since 2001 i got two from 8 weird.I based on on logic.Heavly code in oop.

Tue, 07 Feb 2006 at 03:54:17 GMT Link


114. SK's GravatarSK said:

Before I start, I want to say that I got 6/8. And no, I wasn’t very pleased with that score, since I am quite well-versed with the PHP language - not that it’s too hard to be! But I definitely have to brush up a bit if I'm going to take the certification exam.

I made one silly mistake - question #4; it’s been a while since I've had to deal with non-decimal numbers. The other mistake that I'd made was with question #5, where I thought all this while that PHP functions return a zero when there isn't an explicit return statement. But then I know that (null == 0) will return true, so ($return == 0) is true - which is the reason for my (false) belief. However, if you do a strict comparison, ($result === 0) fails, while ($result === null) holds true.

You never know when this knowledge will be useful!

In one particular project, the return types were so important that I had to use strict comparisons throughout the code. Otherwise the script would behave erratically under different conditions, but all within reason which I later found out.

As for the issues some of us have with the questions involving count(), all I can say is that it doesn't hurt to have a thorough understanding of how something works. And you never know, that tiny piece of information may be all that you need to solve a mysterious (as some users call it) bug - ofcourse there are always a million other trivial work arounds.

I noticed someone complaining about question #8. If you haven't heard of register_globals, then I suggest reading up on PHP security issues. It's important you do this, for you never know, you could be carrying on terrible programming practices, leaving the system wide open to attacks - only if that sort of thing concerns you, unless you leave that sort of detail to the quality control team. I'm not saying that register_globals is strictly banned, especially since some shared hosting providers have it turned on, which means you have to know what the security implications are in order to keep the app fairly secure. You must acquaint yourself with the various INI file settings, as it may affect application design – this is very important when it comes to file uploads and high volume database access.

I haven't done a study on it, nor do I have statistical figures, but I can still say with confidence that given access to the PHP manual, most PHP programmers would eventually get the job done.

We had a couple of PHP programmers whom we later discovered didn’t have a clue as to how binary data is saved in the backend. But they eventually managed to get the job done. Then when we used another app to retrieve the binary content, we found out that it wasn’t stored in binary. After a bit of mucking around we realized it was stored in Base64 format – what a huge waste of storage space. And the reason they converted the data from binary to Base64 was because they didn’t have a clue as to how to store the actual binary content! The work around got the job done, but it wasn’t done right and it was taking up a huge amount of unnecessary storage space (roughly by a factor of 7). By the way, SQL Server’s image data-type requires binary content to be sent to it in hex format, which ‘it’ converts to binary. On retrieval however, it comes out directly in binary format and not in hex. So when inserting you need to unpack to hex, and when selecting you don’t have to do anything special.

You have to know these things or you’re going to be wasting a lot of precious time trying to figure it all out, if not a work around. I’m pretty sure everyone can eventually figure it out, but it’s about what you already know that sets you apart – not what you are capable of finding out by using Google or the PHP manual!!

Also, consider yourself in a scenario where you need to go over to a client's place and fix an undocumented bug on a local intranet website. Apparently, it's mission critical to have the problem solved on the spot. And to make matters worse (for some at least), you don’t have the PHP manual or access to the internet, but you still need to get the bug solved or you might loose your status as a competent PHP programmer. The management guy who may be sitting right next to you won't necessarily have a clue that some of us need the PHP manual to be able to get any work done!

I'm not saying you need to know the manual inside out. But seriously, having to know the syntax shouldn't be such a big issue. It is such a severe waste of time, if you're going to be referring every single internal PHP function. And if you find yourself using Google every time you’re about to implement a new piece of functionality, then you might benefit from some professional training in PHP.

Basically, stop whining and complaining, just because the test score doesn't agree with your beliefs. It just means you've got at least a little bit of brushing up to do! Learn to enjoy it - it can be fun (if you’re geeky enough ofcourse)!!

I’m off to doing some brushing up myself. I guess nobody’s perfect!

Sat, 11 Feb 2006 at 16:06:54 GMT Link


115. SK Again!'s GravatarSK Again! said:

Thought some of us might benefit from the type comparisons.

Cheers!

Sat, 11 Feb 2006 at 16:36:36 GMT Link


116. SK's GravatarSK said:

http://www.php.net/manual/en/types.comparisons.php

Sat, 11 Feb 2006 at 16:38:32 GMT Link


117. Michael's GravatarMichael said:

I'd just like to comment on #5 in response to someone's question about whether or not there's a point to having it on the test. Personally I think that if nothing else it helps to demonstrate a programmer's debugging ability - we all write code that's missing a semi-colon or a quote and sometimes even an entire command like the return statement - which can be very important to your code after the function call resulting in the correct output.

Hope it helps!

Thu, 16 Feb 2006 at 16:34:25 GMT Link


118. Jose's GravatarJose said:

About 6 years of pro PHP development, also versed in other languages (Delphi,VB, etc). I got 3/8.

I agree with the sentiment that those 8 questions do not seem to test my capacity as a PHP developer but focus on insane knowledge of one of the largest manuals for programming. I think that any developer that knows what count() returns when called with anything other than an array needs to be giving explanations, not the other way around.

The question about print_f() is equivalent to asking about the lengthy set of options in the date() function. You do not need to waste your life and brain cells memorizing stuff that is a click away in the manual. I don't even use print_f() for that matter.

I'm planning to take the Zend test only to enhance my CV. I thought it should be an easy ride for real programmers, but now I'm thinking I'm going to have to waste a weekend unnecessarily learning the minors of each function and language construct. You can bet it will all be out of my memory banks before the next weekened.

Mon, 20 Feb 2006 at 01:08:03 GMT Link


119. Dave's GravatarDave said:

Great discussion.

I'm looking at the Zend Cert BUT while reading all these comments and only managing a 3/8!!!! I think I'll reconsider.

I too have used PHP to develop everything from Small CMS to shopping carts, probably for the past 2 years.

Who would, in there right mind, try and count a string?

I would trim() and whitespace of strings and substrings, AND I would pre-format most values before pumping them through to HTML... That's just me I guess.

Anyway, when I run through a test I hope to learn something valuable but with this one I only learnt that I wasn't carefull while reading other peoples code... I didn't feel like I could go away and really revise a topic.

I wouldn't say that I'm the greatest PHP programmer but I would also give this test a low score.

Tue, 21 Feb 2006 at 07:03:40 GMT Link


120. Dave's GravatarDave said:

One More Point.

I have just completed the sample chapters of the PHP|a book and got 60%.. I thought some of those questions were OK and got me thinking a lot more.

I beleive more generalised questions about overall design and layout are in order.

Syntax is, or at least should be, a given with proper reference.

Don't know how long this link will be valid

http://www.phparch.com/shop_product.php?itemid=73

Tue, 21 Feb 2006 at 07:36:22 GMT Link


121. Nate Klaiber's GravatarNate Klaiber said:

Dave,

I felt the same way after taking the practice test. I have been programming PHP for over 4 years now, and sometimes its hard to really go back to the basics. However, don't let that deter you.

I recently purchased the study guide and practice test (link from your past post) and it has helped immensely. It helps you to know the language and WHY certain things happen (Even if you would never really run into the situation).

The biggest part for me is there are sections that I dont use very often - but the test covers all of the basics of PHP. This just caused me to freshen up on what I don't use very often.

I am going to take the test next month and am very excited for it (and nervous). I hope you too make the decision to take the test. What can it hurt?

Tue, 21 Feb 2006 at 14:09:32 GMT Link


122. Anh N.'s GravatarAnh N. said:

I wanted to get the certification, but I guess I'll wait on it a bit until the price drop or if I have a lot of spare cash and time.

This sample exam is ok, half of it isn't realistic or really worthy. But half are good questions. Question 3,4,5, and 7 and applicable in real life and does test your knowledge of programming structure and how you think.

3, 4, and 5 are essential logic test. If you got formal training in Comp Sci, these are the kind of brain teasers that come up in tests. CS doesn't teach you syntax as much as "How to Think."

7 is a great question because it test symantics and a programmer's knowledge of the language's current development. Register Global issue come up a lot in server admin circles.

I hope they have more logic and real life type questions though. The other 4 that I didn't list aren't applicable to evaluating someone's skill, and as other have said, good programmers will know when to get out the references.

I think I will try to get this certificate during the summer. What can I say, I like shiny certificates with my name on them. :)

Mon, 27 Feb 2006 at 01:00:18 GMT Link


123. Vlasis's GravatarVlasis said:

I have never composed PHP code in my life. i just happen to know the logical of programming and got a 5/8 answers correct. i believe that the test is not very representative of whether someone can take the exam or not... I just started reading Programming in PHP and i don't believe i can take the exam. Or maybe i am that good!?

Sat, 04 Mar 2006 at 19:35:35 GMT Link


124. Jenny's GravatarJenny said:

hmmm, just wodering why on this site half of the comments appear empty.

as for the exam, questions 3 and 4 are absolutely useless, as no one uses this syntax anymore. While it helps to know the old way, it in no shape of form determines your ability to code in php4 or php5.

Just like shakespearian english, it is nice to know but no one uses it.

wonder if my comments will actually show up?

Tue, 07 Mar 2006 at 09:16:30 GMT Link


125. Amjad A.'s GravatarAmjad A. said:

Question 3

Given

$text = 'Content-Type: text/xml';

Which of the following prints 'text/xml'?

A. print substr($text, strchr($text, ':'));

B. print substr($text, strchr($text, ':') + 1);

C. print substr($text, strpos($text, ':') + 1);

D. print substr($text, strpos($text, ':') + 2);

E. print substr($text, 0, strchr($text, ':'));

The answer is D. The string position of : (the colon) is two less than the string position of the t, so strpos($text, ':') + 2 provides the string position of the t. The substr() syntax therefore says that we want the substring of $text that begins with the t and continues to the end of the string.

if you run the given code then C. and D. giving the same output i.e, 'text/xml'. plz check this out, but you are saying that answer would be D. how is that?

Tue, 07 Mar 2006 at 14:36:10 GMT Link


126. Nate Klaiber's GravatarNate Klaiber said:

RE: Amjad

The answer IS D, and it is the perfect example. C would return ' text/xml' (with a leading space). The question is asking for specifically 'text/xml' - no leading or trailing spaces.

So, while they would both HAVE the text in the result, D would be the best solution or answer given.

This seems to be explained in the question details, but there could be something I am missing. I am sure Chris could clarify.

Peace,

Nate

Tue, 07 Mar 2006 at 15:23:05 GMT Link


127. Abhijit's GravatarAbhijit said:

hi there...i jus gave the sample test...and for the 3rd question...the options C and D give the same correct output...what is the difference between the two statements...

thanx,

abhijit

(abhijit.b@directi.com)

Sat, 11 Mar 2006 at 11:14:56 GMT Link


128. Doug's GravatarDoug said:

If anything, this test is a good demonstration of things wrong with PHP. 0123 means octal, that is just plain nuts.

count() isn't polymorphic, like len() in python.

Most of the questions are examples of bad programming. I guess if that's what we need to learn, whatever.

Thu, 16 Mar 2006 at 13:30:03 GMT Link


129. FokeyJoe's GravatarFokeyJoe said:

2/8 and I've been pro for 4 years. It didn't help that I've never used count, because there's an alternative, sizeof, that I use. Even having been a low-level systems engineer, I've never needed to use octal, and I still can't really think of a reason to do this, I'm happier with hex/dec/bin. The content-type question can be misleading from the POV that if it were a real header from a real HTTP message, it doesn't have to have a space after the colon, so you could've missed the first letter of the string you were after. Better to do the strpos+1 and trim the result, as the spec claims you MAY do! And I thought nothing came out of a function that returned nothing because most non-zend IDE people on the planet would do print $result, not var_dump to find out what it was returning. The point should've been that you spotted the lack of a return so causing the problem.

But actually, I'm not complaining that bitterly, you do need to have knowledge of a topic for an exam - that's the reason for taking it! And as some of the blurb said, the exam emphasis is on being able to read the code and determine behaviour - a skill that's needed when induhviduals have been doing the coding!

Sat, 18 Mar 2006 at 11:02:11 GMT Link


130. Robin Vickery's GravatarRobin Vickery said:

Doug wrote:

If anything, this test is a good demonstration of things wrong with PHP. 0123 means octal, that is just plain nuts.

Why? it's not exactly a new convention.

$ python -c 'print 0123;' # 83

$ php -r 'print 0123;' # 83

$ perl -e 'print 0123;' # 83

$ pike -e 'write((string) 0123);' # 83

$ echo $((0123)) # 83 (bash)

I got 5. wrong: I've been using perl a lot recently, in which the answer would be 4.

I got 6. wrong: I'm an idiot.

-robin

Mon, 20 Mar 2006 at 12:31:18 GMT Link


131. Robin Vickery's GravatarRobin Vickery said:

I wrote:

$ echo $((0123)) # 83 (bash)

Just for consistency's sake, can I amend that to:

$ posh -c 'echo $((0123))' # 83

-robin

Mon, 20 Mar 2006 at 13:03:47 GMT Link


132. Randell Benavidez's GravatarRandell Benavidez said:

I've had several projects using PHP and was surprised by the questions. And the result. Only got 4/8.

Still, certifications are certifications. Exams are exams. If all PHP programmers will commit the same mistakes, how can you say that you are better?

It's when you commit mistakes less.

I'd like to take the certification. I wish someone would sponsor for the voucher and study guides.

--- chai356@yahoo.com ---

Sat, 01 Apr 2006 at 12:31:39 GMT Link


133</