<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/language.namespaces.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'language.namespaces.global.php',
    1 => 'Global space',
    2 => 'Global space',
  ),
  'up' => 
  array (
    0 => 'language.namespaces.php',
    1 => 'Namespaces',
  ),
  'prev' => 
  array (
    0 => 'language.namespaces.importing.php',
    1 => 'Aliasing and Importing',
  ),
  'next' => 
  array (
    0 => 'language.namespaces.fallback.php',
    1 => 'Fallback to global space',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'language/namespaces.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="language.namespaces.global" class="sect1">
  <h2 class="title">Global space</h2>
  
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</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 <code class="literal">\</code> will specify that
   the name is required from the global space even in the context of the
   namespace.
   <div class="example" id="example-1">
    <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 </span><span style="color: #0000BB">A\B\C</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/* This function is A\B\C\fopen */<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">fopen</span><span style="color: #007700">() {<br />     </span><span style="color: #FF8000">/* ... */<br />     </span><span style="color: #0000BB">$f </span><span style="color: #007700">= </span><span style="color: #0000BB">\fopen</span><span style="color: #007700">(...); </span><span style="color: #FF8000">// call global fopen<br />     </span><span style="color: #007700">return </span><span style="color: #0000BB">$f</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div><?php manual_footer($setup); ?>