nerdexam
Zend

200-530 · Question #166

What is the output of the following script? 1 <?php 2 class a 3 { 4 public $val = 10; 5 } Zend 200-530 Exam 7 function renderVal (a $a) 8 { 9 return $a->$val; 10 } 12 renderVal (new a); 13 ?>

The correct answer is C. A fatal error. See the full explanation below for the reasoning.

Question

What is the output of the following script? 1 <?php 2 class a 3 { 4 public $val = 10; 5 } Zend 200-530 Exam 7 function renderVal (a $a) 8 { 9 return $a->$val; 10 } 12 renderVal (new a); 13 ?>

Options

  • ANothing
  • BNULL
  • CA fatal error
  • D$val
  • E10

How the community answered

(43 responses)
  • A
    16% (7)
  • B
    2% (1)
  • C
    72% (31)
  • D
    2% (1)
  • E
    7% (3)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice