Posted by: Pdfprep
Post Date: December 17, 2020
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
Leave a Reply