Page 1 of 1

PHP Certification Exam - Which function is incorrect?

Posted: Thu May 28, 2009 11:27 pm
by phpcat

Code: Select all

Which of the following is incorrect?
 
Answers: (choose 4)
 
a) function c(MyClass $a = new MyClass())
b) function d($a = null)
c) function e(&$a = 30)
d) function a(&$a = array(10,20,30))
e) function b($a = (10 + 2))
According to the exam, four are wrong and one is right. It seems that A and E are definitely wrong. But B, C, and D don't give any errors. Can anyone shed some light on this?

Re: PHP Certification Exam - Which function is incorrect?

Posted: Fri May 29, 2009 1:04 am
by McInfo
The question is antiquated. It applies to PHP 4 and earlier versions.
PHP Manual wrote:As of PHP 5, default values may be passed by reference.
PHP Manual: Function arguments

Edit: This post was recovered from search engine cache.

Re: PHP Certification Exam - Which function is incorrect?

Posted: Fri May 29, 2009 1:18 am
by phpcat
This is a mock test for the PHP 5 certification that you can order from Zend.com. It appears they made a mistake on this question. So, the only incorrect answers are A and E, right?

Re: PHP Certification Exam - Which function is incorrect?

Posted: Fri May 29, 2009 2:58 am
by McInfo
There is no right answer. The key does not match the lock.

Edit: This post was recovered from search engine cache.