Exam4Training

echo array_key_exists(‘a’, $x)?

What is the output of the following code?

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’;
A . false-false
B . false-true
C . true-false
D . true-true

Answer: B

Exit mobile version