<?php
class test {
function __construct(){}
private function test1(){
echo "In test1", PHP_EOL;
}
private function test2(){
echo "test2", PHP_EOL;
}
protected function test3(){
return "test3" . PHP_EOL;
}
public function __call($method,$arguments) {
$this->test1();
}
}
}
$a = new test;
$a->test2();
echo $a->test3();
/*
* Output:
* In test1
* test2
* In test1
* test3
*/
PD9waHAKCmNsYXNzIHRlc3QgewogICAgZnVuY3Rpb24gX19jb25zdHJ1Y3QoKXt9CgogICAgcHJpdmF0ZSBmdW5jdGlvbiB0ZXN0MSgpewogICAgICAgIGVjaG8gIkluIHRlc3QxIiwgUEhQX0VPTDsKICAgIH0KICAgIHByaXZhdGUgZnVuY3Rpb24gdGVzdDIoKXsKICAgICAgICBlY2hvICJ0ZXN0MiIsIFBIUF9FT0w7CiAgICB9CiAgICBwcm90ZWN0ZWQgZnVuY3Rpb24gdGVzdDMoKXsKICAgICAgICByZXR1cm4gInRlc3QzIiAuIFBIUF9FT0w7CiAgICB9CiAgICBwdWJsaWMgZnVuY3Rpb24gX19jYWxsKCRtZXRob2QsJGFyZ3VtZW50cykgewogICAgICAgIGlmKG1ldGhvZF9leGlzdHMoJHRoaXMsICRtZXRob2QpKSB7CiAgICAgICAgICAgICR0aGlzLT50ZXN0MSgpOwogICAgICAgICAgICByZXR1cm4gY2FsbF91c2VyX2Z1bmNfYXJyYXkoYXJyYXkoJHRoaXMsJG1ldGhvZCksJGFyZ3VtZW50cyk7CiAgICAgICAgfQogICAgfQp9CgokYSA9IG5ldyB0ZXN0OwokYS0+dGVzdDIoKTsKZWNobyAkYS0+dGVzdDMoKTsKLyoKICogT3V0cHV0OgogKiBJbiB0ZXN0MQogKiB0ZXN0MgogKiBJbiB0ZXN0MQogKiB0ZXN0MwogKi8=