📄 language.references.spot.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Spotting References</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.references.html">References Explained</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.variables.html">Predefined variables</a></div> <div class="up"><a href="language.references.html">References Explained</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="language.references.spot" class="sect1"> <h2 class="title">Spotting References</h2> <p class="simpara"> Many syntax constructs in PHP are implemented via referencing mechanisms, so everything told above about reference binding also apply to these constructs. Some constructs, like passing and returning by-reference, are mentioned above. Other constructs that use references are: </p> <div id="references.global" class="sect2"> <h3 class="title"><i>global</i> References</h3> <p class="para"> When you declare variable as <strong class="command">global $var</strong> you are in fact creating reference to a global variable. That means, this is the same as: <div class="informalexample"> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$var </span><span style="color: #007700">=& </span><span style="color: #0000BB">$GLOBALS</span><span style="color: #007700">[</span><span style="color: #DD0000">"var"</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> <p class="simpara"> That means, for example, that unsetting <var class="varname">$var</var> won't unset global variable. </p> </div> <div id="references.this" class="sect2"> <h3 class="title"><i>$this</i></h3> <p class="simpara"> In an object method, <var class="varname">$this</var> is always a reference to the caller object. </p> </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.references.html">References Explained</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.variables.html">Predefined variables</a></div> <div class="up"><a href="language.references.html">References Explained</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -