Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 8905

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Global space</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.namespaces.importing.html">Using namespaces: Aliasing/Importing</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.namespaces.fallback.html">Using namespaces: fallback to global function/constant</a></div>
 <div class="up"><a href="language.namespaces.html">Namespaces</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="language.namespaces.global" class="sect1">
  <h2 class="title">Global space</h2>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0)</p>
  <p class="para">
   Without any namespace definition, all class and function definitions are
   placed into the global space - as it was in PHP before namespaces were
   supported. Prefixing a name with <em>\</em> will specify that 
   the name is required from the global space even in the context of the 
   namespace.
   <div class="example" id="example-254">
    <p><strong>Example #1 Using global space specification</strong></p>
    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">namespace&nbsp;</span><span style="color: #0000BB">A</span><span style="color: #007700">\</span><span style="color: #0000BB">B</span><span style="color: #007700">\</span><span style="color: #0000BB">C</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/*&nbsp;This&nbsp;function&nbsp;is&nbsp;A\B\C\fopen&nbsp;*/<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">()&nbsp;{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;...&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$f&nbsp;</span><span style="color: #007700">=&nbsp;\</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(...);&nbsp;</span><span style="color: #FF8000">//&nbsp;call&nbsp;global&nbsp;fopen<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">$f</span><span style="color: #007700">;<br />}&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.namespaces.importing.html">Using namespaces: Aliasing/Importing</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.namespaces.fallback.html">Using namespaces: fallback to global function/constant</a></div>
 <div class="up"><a href="language.namespaces.html">Namespaces</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>