<?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="simpara">
   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;PHP 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="simpara">
     Function names use underscores between words, class names use
     <code class="literal">PascalCase</code>, and method names use
     <code class="literal">camelCase</code>.
    </p>
   </li>
   <li class="listitem">
    <p class="simpara">
     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, so some existing names are not prefixed.) Examples:
    </p>

    <ul class="itemizedlist">
     <li class="listitem"><p class="simpara"><span class="function"><a href="function.curl-exec.php" class="function">curl_exec()</a></span></p></li>
     <li class="listitem"><p class="simpara"><span class="function"><a href="mysqli.query.php" class="function">mysqli_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="simpara">
     PHP reserves all symbols starting with <code class="literal">__</code>
     as magical. It is recommended not to create symbols starting with
     <code class="literal">__</code> in PHP, unless the intent is to use documented
     magical functionality. Examples:
    </p>
    <ul class="itemizedlist">
     <li class="listitem">
      <p class="simpara"><a href="language.oop5.overloading.php#object.get" class="link">__get()</a></p>
     </li>
     <li class="listitem">
      <p class="simpara"><a href="language.oop5.decon.php#object.construct" class="link">__construct()</a></p>
     </li>
    </ul>
   </li>
  </ul>
 </div><?php manual_footer($setup); ?>