Zend Exam Tips – double check the question before answering

http://knowfree.net/

If you are a professional and you are working full time (sometimes even more), like yours trully, then here comes a good tip.

Not only once, but more often than I would like, I have answered wrongly a question just because I have read it fast.

Take a look at this question:

What is the output of the following?

<?php
function 1dotEach($n)
{
if ($n > 0)
{
1dotEach(–$n);
echo “.”;
}else
{
return $n;
}
}
1dotEach(4);
?>

Answer…
A) …0
B) Parse Error: Syntax Error
C) …..
D) ….
E) …

At first you would consider A or E as the answer for this question, but, take a second look at the line where the function is defined. The function starts with 1, a number and in PHP you cant have functions names,  variables names, class names, object names, etc,  starting with numbers which make B the correct answer for this.

About mcloide

Making things simpler, just check: http://www.mcloide.com View all posts by mcloide

4 responses to “Zend Exam Tips – double check the question before answering

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: