<?php
// +----------------------------------------------------------------------
// | Created by im-server.
// +----------------------------------------------------------------------
// | Language Reference >> References Explained >> Spotting References
// +----------------------------------------------------------------------
// | Author: alexander <gt199899@gmail.com>
// +----------------------------------------------------------------------
// | Datetime: 2017-07-16 18:44
// +----------------------------------------------------------------------
// | Perfect Is Shit
// +----------------------------------------------------------------------
/**
* 许多 PHP 的语法结构是通过引用机制实现的。
* case1:global $var
* case2:$this
*/
namespace case1;
$a = 1;
function test()
{
// 以下两种方式是等效的
global $a;
$b = &$GLOBALS['a'];
}
namespace case2;
class test
{
public $a = 1;
public function a()
{
return $this->a;
}
}
php_lang_ref:Language Reference >> References Explained >> Spotting References
最新推荐文章于 2020-07-14 09:30:12 发布