downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/language.references.spot.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/language.references.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'language.references.spot.php',
   
1 => 'Spotting References',
  ),
 
'up' =>
  array (
   
0 => 'language.references.php',
   
1 => 'References Explained',
  ),
 
'prev' =>
  array (
   
0 => 'language.references.unset.php',
   
1 => 'Unsetting References',
  ),
 
'next' =>
  array (
   
0 => 'reserved.variables.php',
   
1 => 'Predefined Variables',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<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 mentioned herein about reference binding also
    applies 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">global References</h3>
    <p class="para">
     When you declare a 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:
     </p><div class="informalexample">
      <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$var&nbsp;</span><span style="color: #007700">=&amp;&nbsp;</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">?&gt;</span>
</span>
</code></div>
      </div>

     </div><p>
    </p>
    <p class="simpara">
     This also means that unsetting <var class="varname">$var</var>
     won&#039;t unset the 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><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites