Exemple #1
0
 public function __destruct()
 {
     self::$staticMethods = [];
 }
hi($test, "Miss.");
// Hi, Miss. xiaohong!
hello("Miss.");
// Hello, Miss. xiaohong!
echo EOL2;
echo "Test2" . EOL;
$say2 = new ProxyMethod("Hello", "xiaoming");
$say2->hi("Mr.");
// Hi, Mr. xiaoming!
$say2::hello("Mr.");
// Hello, Mr. xiaoming!
$say2->test();
// test inheritance
$say2::staticTest();
// test inheritance, static
$say2->alias("hi", "nihao1");
$say2->nihao1("Mr.");
// Hi, Mr. xiaoming!
$say2->rename("hi", "nihao2");
$say2->nihao2("Mr.");
// Hi, Mr. xiaoming!
//$proxy2->hi("Mr."); // Exception
echo EOL2;
echo "Test3" . EOL;
$stack = new ProxyMethod("SplStack");
foreach (range(0, 9) as $i) {
    $stack->push($i);
}
foreach (range(0, 9) as $i) {
    echo $stack->pop() . " ";
}