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)- A4% (2)
- B74% (40)
- C7% (4)
- D15% (8)
Topics
#object casting#private properties#array conversion#array_key_exists
Community Discussion
No community discussion yet for this question.