<?php
class base {
function calc() {
static $foo = 0;
$foo++;
return $foo;
}
}
class one extends base {
function e() {
echo "one:".$this->calc().PHP_EOL;
}
}
class two extends base {
function p() {
echo "two:".$this->calc().PHP_EOL;
}
}
$x = new one();
$y = new two();
$x_repeat = new one();
$x->e();
$y->p();
$x->e();
$x_repeat->e();
$x->e();
$x_repeat->e();
$y->p();
// your code goes here
PD9waHAKY2xhc3MgYmFzZSB7CgkgZnVuY3Rpb24gY2FsYygpIHsKCSAJc3RhdGljICRmb28gPSAwOwoJIAkkZm9vKys7CgkgCXJldHVybiAkZm9vOwoJIH0KfQoKY2xhc3Mgb25lIGV4dGVuZHMgYmFzZSB7CglmdW5jdGlvbiBlKCkgewoJCWVjaG8gIm9uZToiLiR0aGlzLT5jYWxjKCkuUEhQX0VPTDsKCX0KfQpjbGFzcyB0d28gZXh0ZW5kcyBiYXNlIHsKCWZ1bmN0aW9uIHAoKSB7CgkJZWNobyAidHdvOiIuJHRoaXMtPmNhbGMoKS5QSFBfRU9MOwoJfQp9CiR4ID0gbmV3IG9uZSgpOwokeSA9IG5ldyB0d28oKTsKJHhfcmVwZWF0ID0gbmV3IG9uZSgpOwoKJHgtPmUoKTsKJHktPnAoKTsKJHgtPmUoKTsKJHhfcmVwZWF0LT5lKCk7CiR4LT5lKCk7CiR4X3JlcGVhdC0+ZSgpOwokeS0+cCgpOwovLyB5b3VyIGNvZGUgZ29lcyBoZXJl