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();
A . 0
B . 1
C . 2
D . 3
Answer: D
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments