示例#1
0
文件: 1968.php 项目: badlamer/hhvm
 public function printX()
 {
     var_dump(self::$x);
     self::$x = 4;
 }
示例#2
0
文件: 1957.php 项目: badlamer/hhvm
<?php

trait MY_TRAIT
{
    public function sayHello()
    {
        echo 'World!';
    }
}
class MY_CLASS
{
    use MY_TRAIT;
}
$MY_OBJ = new MY_CLASS();
$MY_OBJ->sayHello();
?>

示例#3
0
文件: 1992.php 项目: badlamer/hhvm
<?php

trait MY_TRAIT
{
    public function sayHello()
    {
        echo "Hello World!\n";
    }
}
class MY_CLASS
{
    use MY_TRAIT {
        sayHello as falaOi;
    }
}
$a = new MY_CLASS();
$a->falaOi();
示例#4
0
文件: 1958.php 项目: badlamer/hhvm
<?php

trait MY_TRAIT1
{
    public function sayHello()
    {
        echo "Hello from MY_TRAIT1\n";
    }
}
trait MY_TRAIT2
{
    use MY_TRAIT1;
    public function sayHello()
    {
        echo "Hello from MY_TRAIT2\n";
    }
}
class MY_CLASS
{
    use MY_TRAIT2;
}
$o = new MY_CLASS();
$o->sayHello();
示例#5
0
文件: 1969.php 项目: badlamer/hhvm
<?php

trait MY_TRAIT
{
    public static $x = 3;
}
class MY_CLASS
{
    use MY_TRAIT;
    public function printX()
    {
        var_dump(self::$x);
    }
}
$o = new MY_CLASS();
$o->printX();
示例#6
0
文件: 1966.php 项目: badlamer/hhvm
<?php

trait T1
{
    var $x = 1977;
}
trait T2
{
    var $x = 1977;
}
class MY_CLASS
{
    use T1, T2;
    var $abc = 1;
    public function printProps()
    {
        var_dump($this->x);
    }
}
$o = new MY_CLASS();
$o->printProps();