nerdexam
Zend

200-530 · Question #420

Consider the following PHP code snippet: <?php class Object { function Object( $entity ) { $entity->name="John"; } } class Entity { var $name = "Maria"; } $entity = new Entity(); $obj = new Object(…

The correct answer is C. John. See the full explanation below for the reasoning.

Question

Consider the following PHP code snippet: <?php class Object { function Object( $entity ) { $entity->name="John"; } } class Entity { var $name = "Maria"; } $entity = new Entity(); $obj = new Object( $entity ); print $entity->name; ?> What should be the output of this script? Zend 200-530 Exam

Options

  • AJohnMaria
  • BMaria
  • CJohn
  • DThe script will throw an error message.

How the community answered

(38 responses)
  • A
    5% (2)
  • B
    11% (4)
  • C
    82% (31)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice