本文整理汇总了PHP中B::foo方法的典型用法代码示例。如果您正苦于以下问题:PHP B::foo方法的具体用法?PHP B::foo怎么用?PHP B::foo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类B
的用法示例。
在下文中一共展示了B::foo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_call_method_dataflow
function test_call_method_dataflow()
{
$o = new B();
$o->foo(1, 2);
//SKIP: requires dataflow (simple here, but still)
$o->foo();
}
示例2: test
function test()
{
$a = new A();
echo $a->foo();
$a = new B();
echo $a->foo(555);
echo $a->foo();
}
示例3: bar
function bar()
{
$obj = new A();
$obj->foo(123);
$obj = new B();
$obj->foo(123, 456);
}
示例4: bar
function bar()
{
$obj = new A();
$obj->foo();
$obj = new B();
$obj->foo();
}
示例5: foo2
public function foo2()
{
B::foo();
// B always changes 'static'
self::foo();
// 'self' doesn't change 'static'
}
示例6: test
public static function test()
{
$arr = array('foo');
self::foo();
parent::foo();
self::$arr[0]();
parent::$arr[0]();
echo self::MYCONST . "\n";
echo parent::MYCONST . "\n";
}
示例7: main
function main()
{
$x = null;
if (true) {
$x = new A();
} else {
$x = new B();
}
//TODO: it should call both methods ...
$x->foo();
//var_dump($x);
}
示例8: test
<?php
class A
{
}
class AA extends A
{
function test()
{
print 'AA ok';
}
}
class B
{
function foo(A $obj)
{
$obj->test();
}
}
$obj = new AA();
$b = new B();
$b->foo($obj);
示例9: f
{
print "A::baz\n";
}
private function f()
{
echo "A::f\n";
}
public function g($a)
{
echo "A::g\n";
$a->f();
}
}
class B extends A
{
protected function bar()
{
print "B::bar\n";
$this->baz();
}
public function h($a)
{
print "B::g\n";
$a->f();
}
}
$a = new A();
$b = new B();
$b->foo();
$b->g($a);
#$b->h($a);
示例10: main
function main()
{
$b = new B();
$b->foo();
}
示例11: foo
<?php
class A
{
protected static $foo = 11;
function foo()
{
var_dump(A::$foo);
}
}
class B extends A
{
public static $foo;
}
var_dump(B::$foo);
B::$foo = 123;
A::foo();
示例12: foo
<?php
// Make sure that we can tell which class was called for intercepted static
// methods
class A
{
public function foo()
{
echo 'foo called';
}
}
class B extends A
{
}
fb_intercept('A::foo', function ($_, $called_on) {
var_dump($called_on);
});
A::foo();
B::foo();
// Trigger run_intercept_handler_for_invokefunc codepath
$class = 'B';
$c = 'call_user_fun';
$c .= 'c';
$c(array($class, 'foo'));
示例13: A
<?php
// including scripts example
include "a.php";
require_once "b.php";
f(12345);
$a = new A("AAA");
$a->write();
$a->foo("hello");
$a->write();
$b = new B("BBB");
$b->write();
$b->foo("bye");
$b->write();
fgets(STDIN);
示例14: foo
<?php
class A
{
function foo()
{
$f = static function () {
return self::class;
};
return $f();
}
}
class B extends A
{
}
$b = new B();
var_dump($b->foo());
示例15: B
<?php
require "tests.php";
require "overload_return_type.php";
$b = new B();
check::equal($b->foo(1), 0, "");
check::classname("A", $b->foo("test"));
check::equal(overload_return_type::foo(), 1, "overload_return_type::foo() should be 1");
check::equal(overload_return_type::bar(), 1, "overload_return_type::bar() should be 1");