本文整理汇总了PHP中A::bar方法的典型用法代码示例。如果您正苦于以下问题:PHP A::bar方法的具体用法?PHP A::bar怎么用?PHP A::bar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类A
的用法示例。
在下文中一共展示了A::bar方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foo
function foo()
{
$a = new A();
$a->foo();
$a->bar();
# $a->baz();
}
示例2: doBar
public function doBar()
{
$this->bar();
// B B
B::bar();
// B B
C::bar();
// C C
D::bar();
// D D
F::bar();
// F F
G::bar();
// G G
H::bar();
// H H
parent::bar();
// A B
self::bar();
// B B
static::bar();
// B B
echo "****************\n";
}
示例3: A
<?php
require "tests.php";
require "exception_order.php";
check::functions(array(a_foo, a_bar, a_foobar, a_barfoo));
check::classes(array(A, E1, E2, E3, exception_order, ET_i, ET_d));
check::globals(array(efoovar, foovar, cfoovar, a_sfoovar, a_foovar, a_efoovar));
$a = new A();
try {
$a->foo();
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
}
try {
$a->bar();
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E2 exception thrown', '');
}
try {
$a->foobar();
} catch (Exception $e) {
check::equal($e->getMessage(), 'postcatch unknown', '');
}
try {
$a->barfoo(1);
} catch (Exception $e) {
check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
}
try {
$a->barfoo(2);
} catch (Exception $e) {
示例4: foo
<?php
class A
{
public function foo()
{
$values = array(1, 2, 3);
$values = array_map(function ($p) {
return $this->goo($p);
}, $values);
var_dump($values);
}
public function bar()
{
return $this;
}
public function goo($p)
{
return $p;
}
}
$obj = new A();
var_dump($obj->bar());
$obj->foo();
示例5: __construct
<?php
class A
{
private $fld;
public function __construct($x)
{
$this->fld = $x;
}
public function foo()
{
var_dump($this->fld);
}
public function bar()
{
$this->foo();
}
}
$o = new A(42);
$o2 = new A(55);
$o->bar();
$o2->bar();
示例6: bar
<?php
// Reported by Gary Wassermann.
// August 17th, 2007
// A::bar doesnt update A::q appropriately.
class A
{
static $q = 2345;
function bar()
{
A::$q++;
echo A::$q, "\n";
}
}
A::bar();
var_dump(A::$q);
A::bar();
var_dump(A::$q);
A::bar();
var_dump(A::$q);
$q = 2345;
$q++;
var_dump($q);
$q++;
var_dump($q);
$q++;
var_dump($q);
示例7: foo
{
static function foo()
{
return function () {
var_dump(get_class(), get_called_class());
};
}
function bar()
{
return function () {
var_dump(get_class(), get_called_class(), $this);
};
}
}
$z = "call_user_func";
$a = A::foo();
$a();
$a->__invoke();
$c = array($a, "__invoke");
$c();
call_user_func(array($a, "__invoke"));
$z(array($a, "__invoke"));
echo "\n";
$x = new A();
$b = $x->bar();
$b();
$b->__invoke();
$c = array($b, "__invoke");
$c();
call_user_func(array($b, "__invoke"));
$z(array($b, "__invoke"));
示例8: bar
function bar()
{
$a = new A();
$a->bar(1, "str", array(1, 2, 3));
hphp_invoke_method($a, "A", "bar", array(1, 2));
}
示例9: foo
<?php
class A
{
public function foo()
{
unset($this);
var_dump($this);
}
public static function bar()
{
unset($this);
var_dump($this);
}
}
function goo()
{
unset($this);
var_dump($this);
}
$obj = new A();
$obj->foo();
$obj->bar();
A::bar();
goo();
unset($this);
var_dump($this);