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


PHP foo::test方法代码示例

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


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

示例1: something_that_might_break

        } catch (LocalNonException $e) {
            print "HERE\n";
        } catch (UndefinedClass $e) {
            print "HERE\n";
        } catch (OutOfBoundsException $e) {
            print "HERE\n";
        } catch (\OutOfBoundsException $e) {
            print "HERE\n";
        }
    }
}
class LocalException extends \Exception
{
}
class LocalSubException extends LocalException
{
}
class LocalSubSubException extends LocalSubException
{
}
class LocalNonException
{
}
function something_that_might_break()
{
    print __METHOD__;
    throw new \Exception('a,a,');
}
$f = new foo();
$f->test();
开发者ID:exakat,项目名称:exakat,代码行数:30,代码来源:UnresolvedCatch.01.php

示例2: testPublic

        echo "Bar::testPrivate\n";
    }
}
class Foo extends Bar
{
    public function testPublic()
    {
        echo "Foo::testPublic\n";
    }
    private function testPrivate()
    {
        echo "Foo::testPrivate\n";
    }
}
$myFoo = new foo();
$myFoo->test();
// Bar::testPrivate
// Foo::testPublic
/**
Объекты одного типа имеют доступ к элементам с модификаторами private и protected друг друга,
даже если не являются одним и тем же экземпляром. Это объясняется тем, что реализация видимости
элементов известна внутри этих объектов.

Пример #3 Доступ к элементам с модификатором private из объектов одного типа
*/
class Test
{
    private $foo;
    public function __construct($foo)
    {
        $this->foo = $foo;
开发者ID:AntonBeletsky,项目名称:LearnPHPdocs,代码行数:31,代码来源:Visibility.php

示例3: test

<?php

class foo
{
    public function test(&$x)
    {
        static $lambda;
        $lambda = function &() use(&$x) {
            return $x = $x * $x;
        };
        return $lambda();
    }
}
$test = new foo();
$y = 2;
var_dump($test->test($y));
var_dump($x = $test->test($y));
var_dump($y, $x);
开发者ID:badlamer,项目名称:hhvm,代码行数:18,代码来源:closure_018.php

示例4: bar

    function test_bar()
    {
        var_dump(get_parent_class());
    }
}
class goo extends bar
{
    function test_goo()
    {
        var_dump(get_parent_class());
    }
}
$bar = new bar();
$foo = new foo();
$goo = new goo();
$foo->test();
$bar->test();
$bar->test_bar();
$goo->test();
$goo->test_bar();
$goo->test_goo();
var_dump(get_parent_class($bar));
var_dump(get_parent_class($foo));
var_dump(get_parent_class($goo));
var_dump(get_parent_class("bar"));
var_dump(get_parent_class("foo"));
var_dump(get_parent_class("goo"));
var_dump(get_parent_class("i"));
var_dump(get_parent_class(""));
var_dump(get_parent_class("[[[["));
var_dump(get_parent_class(" "));
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:1458.php

示例5: d

function d()
{
    $obj = new foo();
    return $obj->test();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:dereference_001.php

示例6: test

<?php

class foo
{
    public function test()
    {
        call_user_func(array('FOO', 'ABC'));
        call_user_func(array($this, 'ABC'));
        foo::XYZ();
        self::WWW();
        call_user_func('FOO::ABC');
    }
    function __call($a, $b)
    {
        print "__call:\n";
        var_dump($a);
    }
    public static function __callStatic($a, $b)
    {
        print "__callstatic:\n";
        var_dump($a);
    }
}
$x = new foo();
$x->test();
$x::A();
foo::B();
$f = 'FOO';
$f::C();
$f::$f();
foo::$f();
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:bug45180.php

示例7: array

<?php

class foo
{
    const AAA = 'x';
    const BBB = 'a';
    const CCC = 'a';
    const DDD = self::AAA;
    private static $foo = array(self::BBB => 'a', self::CCC => 'b', self::DDD => self::AAA);
    public static function test()
    {
        self::$foo;
    }
}
foo::test();
print 1;
开发者ID:badlamer,项目名称:hhvm,代码行数:16,代码来源:bug45910.php

示例8: foo

            test_class::test_func4();
        } else {
            echo "test_func4 isn't callable from child\n";
        }
    }
}
$object = new test_class();
$object->test();
if (is_callable(array($object, 'test_func1'))) {
    $object->test_func1();
} else {
    echo "test_func1 isn't callable from outside\n";
}
if (is_callable(array($object, 'test_func2'))) {
    $object->test_func2();
} else {
    echo "test_func2 isn't callable from outside\n";
}
if (is_callable(array('test_class', 'test_func3'))) {
    test_class::test_func3();
} else {
    echo "test_func3 isn't callable from outside\n";
}
if (is_callable(array('test_class', 'test_func4'))) {
    test_class::test_func4();
} else {
    echo "test_func4 isn't callable from outside\n";
}
$object = new foo();
$object->test();
开发者ID:badlamer,项目名称:hhvm,代码行数:30,代码来源:bug29210.php

示例9: test

<?php

class bar
{
}
class foo
{
    public function test()
    {
        class_alias('bar', 'static');
        return new static();
    }
}
$a = new foo();
var_dump($a->test());
开发者ID:badlamer,项目名称:hhvm,代码行数:15,代码来源:class_alias_003.php


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