當前位置: 首頁>>代碼示例>>PHP>>正文


PHP C::h方法代碼示例

本文整理匯總了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();
開發者ID:badlamer,項目名稱:hhvm,代碼行數:29,代碼來源:2058.php

示例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());
開發者ID:ablyler,項目名稱:phan,代碼行數:30,代碼來源:0053_self_static_this.php

示例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";
開發者ID:n3b,項目名稱:hiphop-php,代碼行數:31,代碼來源:static_properties.php

示例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";
 }
開發者ID:badlamer,項目名稱:hhvm,代碼行數:43,代碼來源:static_properties.php


注:本文中的C::h方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。