本文整理汇总了PHP中C::h方法的典型用法代码示例。如果您正苦于以下问题:PHP C::h方法的具体用法?PHP C::h怎么用?PHP C::h使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C
的用法示例。
在下文中一共展示了C::h方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: f
<?php
error_reporting(E_ALL | E_STRICT);
trait T
{
protected function f()
{
return 1;
}
private function p()
{
return 2;
}
function g()
{
return $this->f();
}
function h()
{
return $this->p();
}
}
class C
{
use T;
}
$c = new C();
echo $c->g();
echo $c->h();
示例2: f
{
/**
* @return self
*/
function f()
{
return $this;
}
/**
* @return static
*/
function g()
{
return $this;
}
/**
* @return $this
*/
function h()
{
return $this;
}
function test(C $c)
{
}
}
$c = new C();
$f = $c->test($c->f());
$g = $c->test($c->g());
$h = $c->test($c->h());
示例3: C
$c = new C();
$c->aFunc();
$c->bFunc();
$c->cFunc();
print "isset(C::\$h): " . (isset(C::$h) ? "true" : "false") . "\n";
print "empty(C::\$h): " . (empty(C::$h) ? "true" : "false") . "\n";
print "isset(C::\$i): " . (isset(C::$i) ? "true" : "false") . "\n";
print "empty(C::\$i): " . (empty(C::$i) ? "true" : "false") . "\n";
print "C::\$h: " . C::$h . "\n";
C::$h = 42;
print "C::\$h: " . C::$h . "\n";
C::$h += 42;
print "C::\$h: " . C::$h . "\n";
print "C::\$h: " . ++C::$h . "\n";
print "C::\$h: " . C::$h++ . "\n";
print "C::\$h: " . C::$h-- . "\n";
print "C::\$h: " . --C::$h . "\n";
$x = 1234;
C::$h =& $x;
print "C::\$h: " . C::$h . "\n";
$x++;
print "C::\$h: " . C::$h . "\n";
C::$h = 5678;
print "x: " . $x . "\n";
C::$h = array(0, 1, 2);
$y = C::$h[1];
print "\$y: {$y}\n";
C::$h[2] = 42;
$y = C::$h[2];
print "\$y: {$y}\n";
print "Test end\n";
示例4: main
static function main()
{
$a = new A();
$a->aFunc();
$b = new B();
$b->aFunc();
$b->bFunc();
$c = new C();
$c->aFunc();
$c->bFunc();
$c->cFunc();
print "isset(C::\$h): " . (isset(C::$h) ? "true" : "false") . "\n";
print "empty(C::\$h): " . (empty(C::$h) ? "true" : "false") . "\n";
print "isset(C::\$i): " . (isset(C::$i) ? "true" : "false") . "\n";
print "empty(C::\$i): " . (empty(C::$i) ? "true" : "false") . "\n";
print "C::\$h: " . C::$h . "\n";
C::$h = 42;
print "C::\$h: " . C::$h . "\n";
C::$h += 42;
print "C::\$h: " . C::$h . "\n";
print "C::\$h: " . ++C::$h . "\n";
print "C::\$h: " . C::$h++ . "\n";
print "C::\$h: " . C::$h-- . "\n";
print "C::\$h: " . --C::$h . "\n";
$x = 1234;
C::$h =& $x;
print "C::\$h: " . C::$h . "\n";
$x++;
print "C::\$h: " . C::$h . "\n";
C::$h = 5678;
print "x: " . $x . "\n";
C::$h = array(0, 1, 2);
$y = C::$h[1];
print "\$y: {$y}\n";
C::$h[2] = 42;
$y = C::$h[2];
print "\$y: {$y}\n";
C::$h = 20;
$w =& C::$h;
$w = 5;
print "C::\$h: " . C::$h . "\n";
print "Test end\n";
}