If you are able to answer the following questions, you are certainly one of them! Consider the following script:
<?php
error_reporting(E_ALL | E_STRICT);
$test[isset($test)] = $test;
var_dump($test);
?>
- How many notices are displayed?
- What is the output?
Ok, you replied with:
- 1 notice (Notice: Undefined variable: test in ...)
array(1) {
[0]=>
NULL
}
Congratulations! You just
failed your
Zend Engineer Certification.
Joke aside, correct answers were:
- 0 notice
array(1) {
[0]=>
array(1) {
[0]=>
*RECURSION*
}
}
Well, in PHP 4 you would be in the right, but PHP 5 introduces a new
feature that let you construct a kind of recursive array... More interesting is that if you used an isset on the right part of the assignment it would return you
false!
1 comment:
Is this still accurate? This is what I get:
Notice: Undefined variable: test in E:\Projects\back-orifice\site.20090223\jmoe\- on line 3
array(1) {
[0]=>
NULL
}
My PHP:
PHP 5.2.6 (cli) (built: May 2 2008 18:02:07)
Post a Comment