array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'language.references.spot.php', 1 => '引用定位', ), 'up' => array ( 0 => 'language.references.php', 1 => '引用的解释', ), 'prev' => array ( 0 => 'language.references.unset.php', 1 => '取消引用', ), 'next' => array ( 0 => 'reserved.variables.php', 1 => '预定义变量', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'language/references.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
许多 PHP 的语法结构是通过引用机制实现的,所以上述有关引用绑定的一切也都适用于这些结构。 一些结构,例如引用传递和返回,已经在上面提到了。 其它使用引用的结构有:
当用 global $var 声明一个变量时实际上建立了一个到全局变量的引用。 也就是说和这样做是相同的:
<?php
$var =& $GLOBALS["var"];
?>
这意味着,例如,unset $var 不会 unset 全局变量。
$this
在一个对象的方法中,$this 永远是调用它的对象的引用。