nerdexam
Zend

200-710 · Question #65

QUESTION 68 What is the output of the following code? class Foo implements ArrayAccess { function offsetExists($k) { return true; } function offsetGet($k) { return 'a'; } function offsetSet($k, $v)…

The correct answer is B. false. See the full explanation below for the reasoning.

Arrays

Question

QUESTION 68 What is the output of the following code? class Foo implements ArrayAccess { function offsetExists($k) { return true; } function offsetGet($k) { return 'a'; } function offsetSet($k, $v) {} function offsetUnset($k) {} } $x = new Foo(); echo array_key_exists('foo', $x) ? 'true' : 'false';

Options

  • Atrue
  • Bfalse

How the community answered

(31 responses)
  • A
    26% (8)
  • B
    74% (23)

Topics

#ArrayAccess#array_key_exists#object interface#limitations

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice