arongsoft 发表于 2017-3-30 09:52:36

php返回引用实例

  class Test{
    public $a = array(1,2,3,4);
   
    function &getA()
    {
        return $this->a;
    }
}


$a = new Test();
$b = &$a->getA();

$b = 101;
print_r($a->getA());
页: [1]
查看完整版本: php返回引用实例