コード例 #1
0
ファイル: basic_004.php プロジェクト: lzpfmh/jphp
$invoker = new Invoker(function () {
});
var_dump($invoker->canAccess());
class A
{
    static function test1()
    {
    }
    private static function test2()
    {
    }
    static function test3()
    {
        return new Invoker('A::test2');
    }
}
$invoker = new Invoker('A::test1');
var_dump($invoker->canAccess());
$invoker = A::test3();
var_dump($invoker->canAccess());
$invoker();
$invoker = new Invoker('A::test2');
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
bool(false)

Recoverable error: Argument 1 passed to php\lang\Invoker::__construct() must be of the type callable, string given, called in %s on line %d, position %d and defined in Unknown on line %d, position %d
コード例 #2
0
ファイル: bug30140.php プロジェクト: badlamer/hhvm
<?php

class A
{
    public static $test1 = true;
    public static $test2 = array();
    public static $test3 = "str";
}
class B extends A
{
}
A::$test1 = "x";
A::$test2 = "y";
A::$test3 = "z";
var_dump(A::$test1);
var_dump(A::$test2);
var_dump(A::$test3);
var_dump(B::$test1);
var_dump(B::$test2);
var_dump(B::$test3);