nerdexam
Zend

200-710 · Question #66

class Bar { private $a = 'b'; public $c = 'd'; } $x = (array) new Bar(); echo array_key_exists('a', $x) ? 'true' : 'false'; echo '-'; echo array_key_exists('c', $x) ? 'true' : 'false';

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

Arrays

Question

class Bar { private $a = 'b'; public $c = 'd'; } $x = (array) new Bar(); echo array_key_exists('a', $x) ? 'true' : 'false'; echo '-'; echo array_key_exists('c', $x) ? 'true' : 'false';

Options

  • Afalse-false
  • Bfalse-true
  • Ctrue-false
  • Dtrue-true

How the community answered

(54 responses)
  • A
    4% (2)
  • B
    74% (40)
  • C
    7% (4)
  • D
    15% (8)

Topics

#object casting#private properties#array conversion#array_key_exists

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice