<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/userlandnaming.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'userlandnaming.rules.php',
    1 => 'Rules',
    2 => 'Rules',
  ),
  'up' => 
  array (
    0 => 'userlandnaming.php',
    1 => 'Userland Naming Guide',
  ),
  'prev' => 
  array (
    0 => 'userlandnaming.globalnamespace.php',
    1 => 'Global Namespace',
  ),
  'next' => 
  array (
    0 => 'userlandnaming.tips.php',
    1 => 'Tips',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'appendices/userlandnaming.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="userlandnaming.rules" class="section">
  <h2 class="title">Rules</h2>
  <p class="para">
   The following list gives an overview of which rights the PHP project
   reserves for itself, when choosing names for new internal identifiers.
   The definitive guide is the official
   <a href="https://github.com/php/php-src/raw/master/CODING_STANDARDS.md" class="link external">&raquo;&nbsp;CODING STANDARDS</a>:
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     PHP owns the top-level namespace but tries to find decent descriptive
     names and avoid any obvious clashes.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Function names use underscores between words, while class names use
     both the <code class="literal">camelCase</code> and <code class="literal">PascalCase</code>
     rules.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     PHP will prefix any global symbols of an extension with the name of
     the extension. (In the past, there have been numerous
     exceptions to this rule.) Examples:
    </p>

    <ul class="itemizedlist">
     <li class="listitem"><p class="para"><span class="function"><a href="function.curl-close.php" class="function">curl_close()</a></span></p></li>
     <li class="listitem"><p class="para"><span class="function"><a href="function.mysql-query.php" class="function">mysql_query()</a></span></p></li>
     <li class="listitem"><p class="para">PREG_SPLIT_DELIM_CAPTURE</p></li>
     <li class="listitem"><p class="para">new DOMDocument()</p></li>
     <li class="listitem">
      <p class="para">
       <span class="function"><a href="function.strpos.php" class="function">strpos()</a></span> (example of a past mistake)
      </p>
     </li>
     <li class="listitem"><p class="para">new SplFileObject()</p></li>
    </ul>
   </li>
   <li class="listitem">
    <p class="para">
     Iterators and Exceptions are however simply postfixed with
     &quot;<code class="literal">Iterator</code>&quot; and &quot;<code class="literal">Exception</code>.&quot;
     Examples:
    </p>
    <ul class="itemizedlist">
     <li class="listitem"><p class="para"><span class="classname"><a href="class.arrayiterator.php" class="classname">ArrayIterator</a></span></p></li>
     <li class="listitem"><p class="para"><span class="classname"><a href="class.logicexception.php" class="classname">LogicException</a></span></p></li>
    </ul>
   </li>
   <li class="listitem">
    <p class="para">
     PHP reserves all symbols starting with <code class="literal">__</code>
     as magical. It is recommended that you do not create symbols starting
     with <code class="literal">__</code> in PHP unless
     you want to use documented magical functionality. Examples:
    </p>
    <ul class="itemizedlist">
     <li class="listitem"><p class="para"><a href="language.oop5.overloading.php#object.get" class="link">__get()</a></p></li>
     <li class="listitem"><p class="para"><span class="function"><a href="function.autoload.php" class="function">__autoload()</a></span></p></li>
    </ul>
   </li>
  </ul>
 </div><?php manual_footer($setup); ?>