PrepAway - Latest Free Exam Questions & Answers

What is the output of the following code?

What is the output of the following code? class C { public $x = 1; function __construct() {
++$this->x; } function __invoke() { return ++$this->x; } function __toString() { return (string)
–$this->x; } } $obj = new C(); echo $obj();

PrepAway - Latest Free Exam Questions & Answers

A.
1

B.
2

C.
3

D.
0


Leave a Reply

Your email address will not be published. Required fields are marked *