php-doc-en/appendices/reserved.xml
Peter Cowburn c027c09f4c fix build (missing table title)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@336657 c90b9560-bf6c-de11-be94-00142212c4b1
2015-04-24 19:32:02 +00:00

540 lines
14 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="reserved" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>List of Reserved Words</title>
<para>
The following is a listing of predefined identifiers in PHP. None
of the identifiers listed here should be used as identifiers in any of
your scripts. These lists include keywords and predefined variable,
constant, and class names. These lists are neither exhaustive or
complete.
</para>
<sect1 xml:id="reserved.keywords">
<title>List of Keywords</title>
<simpara>
These words have special meaning in PHP. Some of them represent things
which look like functions, some look like constants, and so on - but
they're not, really: they are language constructs. You cannot use any
of the following words as constants, class names, function or method names.
Using them as variable names is generally OK, but could lead to confusion.
</simpara>
<table>
<title>PHP Keywords</title>
<tgroup cols="5">
<tbody>
<row>
<entry>
<function>__halt_compiler</function>
</entry>
<entry>
<link linkend="language.oop5.abstract">abstract</link>
</entry>
<entry>
<link linkend="language.operators.logical">and</link>
</entry>
<entry>
<function>array</function>
</entry>
<entry>
<link linkend="control-structures.foreach">as</link>
</entry>
</row>
<row>
<entry>
<link linkend="control-structures.break">break</link>
</entry>
<entry>
<link linkend="language.types.callable">callable</link> (as of PHP 5.4)
</entry>
<entry>
<link linkend="control-structures.switch">case</link>
</entry>
<entry>
<link linkend="language.exceptions">catch</link>
</entry>
<entry>
<link linkend="keyword.class">class</link>
</entry>
</row>
<row>
<entry>
<link linkend="language.oop5.cloning">clone</link>
</entry>
<entry>
<link linkend="language.oop5.constants">const</link>
</entry>
<entry>
<link linkend="control-structures.continue">continue</link>
</entry>
<entry>
<link linkend="control-structures.declare">declare</link>
</entry>
<entry>
<link linkend="control-structures.switch">default</link>
</entry>
</row>
<row>
<entry>
<function>die</function>
</entry>
<entry>
<link linkend="control-structures.do.while">do</link>
</entry>
<entry>
<function>echo</function>
</entry>
<entry>
<link linkend="control-structures.else">else</link>
</entry>
<entry>
<link linkend="control-structures.elseif">elseif</link>
</entry>
</row>
<row>
<entry>
<function>empty</function>
</entry>
<entry>
<link linkend="control-structures.declare">enddeclare</link>
</entry>
<entry>
<link linkend="control-structures.alternative-syntax">endfor</link>
</entry>
<entry>
<link linkend="control-structures.alternative-syntax">endforeach</link>
</entry>
<entry>
<link linkend="control-structures.alternative-syntax">endif</link>
</entry>
</row>
<row>
<entry>
<link linkend="control-structures.alternative-syntax">endswitch</link>
</entry>
<entry>
<link linkend="control-structures.alternative-syntax">endwhile</link>
</entry>
<entry>
<function>eval</function>
</entry>
<entry>
<function>exit</function>
</entry>
<entry>
<link linkend="keyword.class">extends</link>
</entry>
</row>
<row>
<entry>
<link linkend="language.oop5.final">final</link>
</entry>
<entry>
<link linkend="language.exceptions">finally</link> (as of PHP 5.5)
</entry>
<entry>
<link linkend="control-structures.for">for</link>
</entry>
<entry>
&foreach;
</entry>
<entry>
<link linkend="functions.user-defined">function</link>
</entry>
</row>
<row>
<entry>
<link linkend="language.variables.scope">global</link>
</entry>
<entry>
<link linkend="control-structures.goto">goto</link> (as of PHP 5.3)
</entry>
<entry>
<link linkend="control-structures.if">if</link>
</entry>
<entry>
<link linkend="language.oop5.interfaces">implements</link>
</entry>
<entry>
<function>include</function>
</entry>
</row>
<row>
<entry>
<function>include_once</function>
</entry>
<entry>
<link linkend="language.operators.type">instanceof</link>
</entry>
<entry>
<link linkend="language.oop5.traits.conflict">insteadof</link> (as of PHP 5.4)
</entry>
<entry>
<link linkend="language.oop5.interfaces">interface</link>
</entry>
<entry>
<function>isset</function>
</entry>
</row>
<row>
<entry>
<function>list</function>
</entry>
<entry>
<link linkend="language.namespaces">namespace</link> (as of PHP 5.3)
</entry>
<entry>
<link linkend="keyword.class">new</link>
</entry>
<entry>
<link linkend="language.operators.logical">or</link>
</entry>
<entry>
<function>print</function>
</entry>
</row>
<row>
<entry>
<link linkend="language.oop5.visibility">private</link>
</entry>
<entry>
<link linkend="language.oop5.visibility">protected</link>
</entry>
<entry>
<link linkend="language.oop5.visibility">public</link>
</entry>
<entry>
<function>require</function>
</entry>
<entry>
<function>require_once</function>
</entry>
</row>
<row>
<entry>
<function>return</function>
</entry>
<entry>
<link linkend="language.variables.scope">static</link>
</entry>
<entry>
<link linkend="control-structures.switch">switch</link>
</entry>
<entry>
<link linkend="language.exceptions">throw</link>
</entry>
<entry>
<link linkend="language.oop5.traits">trait</link> (as of PHP 5.4)
</entry>
</row>
<row>
<entry>
<link linkend="language.exceptions">try</link>
</entry>
<entry>
<function>unset</function>
</entry>
<entry>
<link linkend="language.namespaces">use</link>
</entry>
<entry>
<link linkend="keyword.class">var</link>
</entry>
<entry>
<link linkend="control-structures.while">while</link>
</entry>
</row>
<row>
<entry>
<link linkend="language.operators.logical">xor</link>
</entry>
<entry>
<link linkend="language.generators">yield</link> (as of PHP 5.5)
</entry>
<entry>
</entry>
<entry>
</entry>
<entry>
</entry>
</row>
</tbody>
</tgroup>
</table>
<table>
<title>Compile-time constants</title>
<tgroup cols="5">
<tbody>
<row>
<entry>
<link linkend="language.constants.predefined">__CLASS__</link>
</entry>
<entry>
<link linkend="language.constants.predefined">__DIR__</link> (as of PHP 5.3)
</entry>
<entry>
<link linkend="language.constants.predefined">__FILE__</link>
</entry>
<entry>
<link linkend="language.constants.predefined">__FUNCTION__</link>
</entry>
<entry>
<link linkend="language.constants.predefined">__LINE__</link>
</entry>
<entry>
<link linkend="language.constants.predefined">__METHOD__</link>
</entry>
</row>
<row>
<entry>
<link linkend="language.namespaces.nsconstants">__NAMESPACE__</link> (as of PHP 5.3)
</entry>
<entry>
<link linkend="language.constants.predefined">__TRAIT__</link> (as of PHP 5.4)
</entry>
<entry>
</entry>
<entry>
</entry>
<entry>
</entry>
<entry>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 xml:id="reserved.classes">
<title>Predefined Classes</title>
<para>
This section lists standard predefined classes. Miscellaneous extensions
define other classes which are described in their reference.
</para>
<sect2 xml:id="reserved.classes.standard">
<title>Standard Defined Classes</title>
<simpara>
These classes are defined in the standard set of functions included
in the PHP build.
</simpara>
<variablelist>
<varlistentry>
<term><classname>Directory</classname></term>
<listitem>
<simpara>
Created by <function>dir</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><classname>stdClass</classname></term>
<listitem>
<simpara>
Created by <link linkend="language.types.object.casting">typecasting
to object</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><classname>__PHP_Incomplete_Class</classname></term>
<listitem>
<simpara>
Possibly created by <function>unserialize</function>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 xml:id="reserved.classes.php5">
<title>Predefined classes as of PHP 5</title>
<simpara>
These additional predefined classes were introduced in
PHP 5.0.0.
</simpara>
<variablelist>
<varlistentry>
<term><classname>Exception</classname></term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><classname>ErrorException</classname></term>
<listitem>
<simpara>
Available since PHP 5.1.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><classname>php_user_filter</classname></term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 xml:id="reserved.classes.closure">
<title>Closure</title>
<simpara>
The predefined final class <classname>Closure</classname> was introduced
in PHP 5.3.0. It is used for representing <link
linkend="functions.anonymous">anonymous functions</link>.
</simpara>
<simpara>
For more information, see its <link linkend="class.closure">class
page</link>.
</simpara>
</sect2>
<sect2 xml:id="reserved.classes.generator">
<title>Generator</title>
<simpara>
The predefined final class <classname>Generator</classname> was introduced
in PHP 5.5.0. It is used for representing <link
linkend="language.generators">generators</link>.
</simpara>
<simpara>
For more information, see its <link linkend="class.generator">class
page</link>.
</simpara>
</sect2>
<sect2 xml:id="reserved.classes.special">
<title>Special classes</title>
<simpara>
Following identifiers may not be used as a class name as they have
special purpose.
</simpara>
<variablelist>
<varlistentry>
<term><classname>self</classname></term>
<listitem>
<simpara>
<link linkend="language.oop5.paamayim-nekudotayim">Current
class</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><classname>static</classname></term>
<listitem>
<simpara>
<link linkend="language.oop5.late-static-bindings">Current class in
runtime</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><classname>parent</classname></term>
<listitem>
<simpara>
<link linkend="language.oop5.paamayim-nekudotayim">Parent
class</link>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>
&appendices.reserved.constants;
<sect1 xml:id="reserved.other-reserved-words">
<title>List of other reserved words </title>
<simpara>
These words cannot be used to name a class, interface or a trait.
These words are also prohibited from being used in namespaces.
Some of the words are reserved to enable future PHP features without
breaking backward compatibility.
</simpara>
<para>
<table>
<title>Reserved words</title>
<tgroup cols="5">
<tbody>
<row>
<entry>
int (as of PHP 7)
</entry>
<entry>
float (as of PHP 7)
</entry>
<entry>
bool (as of PHP 7)
</entry>
<entry>
string (as of PHP 7)
</entry>
</row>
<row>
<entry>
true (as of PHP 7)
</entry>
<entry>
false (as of PHP 7)
</entry>
<entry>
null (as of PHP 7)
</entry>
<entry>
resource (as of PHP 7)
</entry>
</row>
<row>
<entry>
object (as of PHP 7)
</entry>
<entry>
mixed (as of PHP 7)
</entry>
<entry>
numeric (as of PHP 7)
</entry>
<entry>
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</sect1>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->