nerdexam
Zend

200-530 · Question #84

Given the following two functions, what statement is correct? function dynamicNew($name) { return new $name; } function reflectionNew($name) { $r = new ReflectionClass($name); return…

The correct answer is B. dynamicNew() results in a parse error, reflectionNew() works. See the full explanation below for the reasoning.

Question

Given the following two functions, what statement is correct? function dynamicNew($name) { return new $name; } function reflectionNew($name) { $r = new ReflectionClass($name); return $r->newInstanceArgs(); }

Options

  • ABoth functions do the same
  • BdynamicNew() results in a parse error, reflectionNew() works

How the community answered

(45 responses)
  • A
    24% (11)
  • B
    76% (34)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice