Zend
200-550 · Question #65
What is the output of the following code? class a { public $val; } function renderVal (a $a) { if ($a) { echo $a->val; } } renderVal (null);
The correct answer is B. An error, because null is not an instance of 'a'. See the full explanation below for the reasoning.
Question
What is the output of the following code? class a { public $val; } function renderVal (a $a) { if ($a) { echo $a->val; } } renderVal (null);
Options
- AA syntax error in the function declaration line
- BAn error, because null is not an instance of 'a'
- CNothing, because a null value is being passed to renderVal()
- DNULL
How the community answered
(19 responses)- A5% (1)
- B74% (14)
- C5% (1)
- D16% (3)
Community Discussion
No community discussion yet for this question.