echo array_key_exists(‘foo’, $x)?

What is the output of the following code?

class Foo Implements Array Access {

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

Answer: B

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments