当前位置: 首页>>代码示例>>PHP>>正文


PHP B::test方法代码示例

本文整理汇总了PHP中B::test方法的典型用法代码示例。如果您正苦于以下问题:PHP B::test方法的具体用法?PHP B::test怎么用?PHP B::test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在B的用法示例。


在下文中一共展示了B::test方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

function main()
{
    $c = new C();
    B::test($c);
    C::test($c);
    D::test($c);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:typehint_lsb_self.php

示例2: main

function main()
{
    $a = new A();
    $b = new B();
    $c = new C();
    B::test($a);
    C::test($b);
    E::test($c);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:typehint_lsb_parent.php

示例3: testNoForward

 public static function testNoForward()
 {
     A::test();
     call_user_func("A::test");
     call_user_func(array("A", "test"));
     B::test();
     call_user_func("B::test");
     call_user_func(array("B", "test"));
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:lsb_021.php

示例4: main

function main()
{
    call_user_func(array('A', 'private_func'), "1", "2", "3");
    call_user_func(array('A', 'protected_func'), "1", "2", "3");
    call_user_func(array('A', 'public_func'), "1", "2", "3");
    call_user_func(array('B', 'private_func'), "1", "2", "3");
    call_user_func(array('B', 'protected_func'), "1", "2", "3");
    call_user_func(array('B', 'public_func'), "1", "2", "3");
    A::test();
    B::test();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:11,代码来源:cuf__callStatic3.php

示例5: mycatch

 public static function mycatch()
 {
     try {
         static::who();
         B::throwException_after();
     } catch (Exception $e) {
         static::who();
         A::test();
         static::who();
         B::test();
         static::who();
         self::simpleCatch();
         static::who();
     }
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:15,代码来源:lsb_015.php

示例6: test

<?php

class A
{
    protected $fld = 42;
    public function test()
    {
        var_dump($this->fld);
    }
}
class B extends A
{
    protected $fld = 2;
}
$a = new A();
$b = new B();
$a->test();
$b->test();
开发者ID:Halfnhav4,项目名称:pfff,代码行数:18,代码来源:protected_redefined.php

示例7: __construction

<?php

class A
{
    protected $a;
    public function __construction()
    {
        echo __CLASS__;
    }
    public function test()
    {
        $b = new self();
        var_dump($this->a);
        die;
        return $b->a;
    }
    public function setA($a)
    {
        $this->a = $a;
    }
}
class B extends A
{
    public function test1()
    {
    }
}
$a = new B();
$a->setA(1);
$b = $a->test();
var_dump($b);
开发者ID:nosun,项目名称:laravel_base,代码行数:31,代码来源:testClass.php

示例8: test

 static function test()
 {
     $b = new B();
     $b->text = [];
     $b->test([1, 2, 3]);
 }
开发者ID:hslatman,项目名称:phan,代码行数:6,代码来源:0037_properties2.php

示例9: test

<?php

trait TestTrait
{
    public static function test()
    {
        return 'Forwarded ' . forward_static_call(array('A', 'test'));
    }
}
class A
{
    public static function test()
    {
        return "Test A";
    }
}
class B extends A
{
    use TestTrait;
}
echo B::test();
开发者ID:gleamingthecube,项目名称:php,代码行数:21,代码来源:Zend_tests_traits_static_forward_static_call.php

示例10: testprivate

<?php

class A
{
    private static function testprivate()
    {
        return 1;
    }
    public static function test()
    {
        return function () {
            return self::testprivate();
        };
    }
}
class B extends A
{
}
$fn = B::test();
echo $fn();
开发者ID:gleamingthecube,项目名称:php,代码行数:20,代码来源:Zend_tests_bug69568.php

示例11: __sleep

    public function __sleep()
    {
        return $GLOBALS['g'];
    }
    static function test($a, $elems, $p = null)
    {
        global $g;
        $a->seta(42);
        $g = $elems;
        $s = serialize($a);
        var_export($s);
        echo "\n";
        $u = unserialize($s);
        var_dump($u);
        if ($p) {
            var_dump($u->{$p});
        }
    }
}
B::test(new A(), array("a"));
B::test(new A(), array("Aa"));
B::test(new A(), array("*a"));
B::test(new A(), array("*b"), "b");
B::test(new A(), array("Bb"), "b");
B::test(new A(), "foo");
B::test(new B(), array("a"));
B::test(new B(), array("Aa"));
B::test(new B(), array("*a"));
B::test(new B(), array("*b"), "b");
B::test(new B(), array("Bb"), "b");
开发者ID:badlamer,项目名称:hhvm,代码行数:30,代码来源:private_properties.php

示例12: test

<?php

class A
{
    const NAME = 'A';
    public static function test()
    {
        $args = func_get_args();
        echo static::NAME, " " . join(',', $args) . " \n";
    }
}
class B extends A
{
    const NAME = 'B';
    public static function test()
    {
        echo self::NAME, "\n";
        forward_static_call(array('A', 'test'), 'more', 'args');
        forward_static_call('test', 'other', 'args');
    }
}
B::test('foo');
function test()
{
    $args = func_get_args();
    echo "C " . join(',', $args) . " \n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:27,代码来源:1875.php

示例13: test

<?php

class A
{
    public static function test($x = null)
    {
        if (!is_null($x)) {
            echo "{$x}\n";
        }
        return get_called_class();
    }
}
class B extends A
{
}
class C extends A
{
}
class D extends A
{
}
echo A::test(B::test(C::test(D::test()))) . "\n";
?>
==DONE==
开发者ID:badlamer,项目名称:hhvm,代码行数:24,代码来源:lsb_017.php

示例14: var_dump

        var_dump(get_object_vars($b));
    }
}
class C extends B
{
    private $hiddenPriv = 'C::hiddenPriv';
    public static function test($b)
    {
        echo __METHOD__ . "\n";
        var_dump(get_object_vars($b));
    }
}
class X
{
    public static function test($b)
    {
        echo __METHOD__ . "\n";
        var_dump(get_object_vars($b));
    }
}
$b = new B();
echo "\n---( Global scope: )---\n";
var_dump(get_object_vars($b));
echo "\n---( Declaring class: )---\n";
B::test($b);
echo "\n---( Subclass: )---\n";
C::test($b);
echo "\n---( Superclass: )---\n";
A::test($b);
echo "\n---( Unrelated class: )---\n";
X::test($b);
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:get_object_vars_basic_001.php

示例15: __construct

}
EventLoop::$instance = new EventLoop();
class A
{
    protected $ev;
    public function __construct(EventLoop $ev)
    {
        $this->ev = $ev;
    }
    public function test()
    {
        return $this->ev;
    }
}
class B
{
    public function test()
    {
        return EventLoop::$instance;
    }
}
$aInstance = new A(new EventLoop());
$benchmark->add('without-static-normal-injection', function () use($aInstance) {
    return $aInstance->test();
});
$bInstance = new B();
$benchmark->add('with-static-global-state', function () use($bInstance) {
    return $bInstance->test();
});
$benchmark->setCount(10000000);
$benchmark->run();
开发者ID:ovr,项目名称:php-web-benchmarks,代码行数:31,代码来源:property-vs-static-property.php


注:本文中的B::test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。