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)- A5% (2)
- B11% (4)
- C82% (31)
- D3% (1)
Community Discussion
No community discussion yet for this question.