Given the following code, what is correct?

Given the following code, what is correct?

function f(stdClass &$x = NULL) { $x = 42;}

$z = new stdClass;

f($z);

var _dump($z);
A . Error: Typehints cannot be NULL
B . Error: Typehints cannot be references
C . Result is NU LL
D . Result is object of type stdClass
E . Result is 42

Answer: E

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments