【php】【特殊案例】数组调用方法

 

As of PHP 5.4.0, you can call any callable stored in a variable.


<?php
class Foo
{
    static function bar()
    {
        echo "bar\n";
    }
    function baz()
    {
        echo "baz\n";
    }
}

$func = array("Foo", "bar");
$func(); // prints "bar"

 

posted @ 2018-09-25 18:08  Flint99  阅读(226)  评论(0编辑  收藏  举报