mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

The table of reserved keywords obviously has four columns, and this should be reflected by the `col` attribute (although that is apparently ignored by PhD for now). We also specify four columns for the table of soft reserved words.
610 lines
16 KiB
XML
610 lines
16 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 unless explicitly noted otherwise. These lists include keywords and predefined variables,
|
|
constant, and class names. These lists are neither exhaustive nor
|
|
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.
|
|
The following words cannot be used as constants, class names, function or method names.
|
|
They are, however, allowed as property, constant, and
|
|
method names of classes, interfaces and traits, except that
|
|
<literal>class</literal> may not be used as constant name.
|
|
</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>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="control-structures.switch">case</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.exceptions">catch</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.oop5.basic.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="language.oop5.basic.extends">extends</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<link linkend="language.oop5.final">final</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.exceptions">finally</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="functions.arrow">fn</link> (as of PHP 7.4)
|
|
</entry>
|
|
<entry>
|
|
<link linkend="control-structures.for">for</link>
|
|
</entry>
|
|
<entry>
|
|
&foreach;
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<link linkend="functions.user-defined">function</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.variables.scope">global</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="control-structures.goto">goto</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="control-structures.if">if</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.oop5.interfaces">implements</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<function>include</function>
|
|
</entry>
|
|
<entry>
|
|
<function>include_once</function>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.operators.type">instanceof</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.oop5.traits.conflict">insteadof</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.oop5.interfaces">interface</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<function>isset</function>
|
|
</entry>
|
|
<entry>
|
|
<function>list</function>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="control-structures.match">match</link> (as of PHP 8.0)
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.namespaces">namespace</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.oop5.basic.new">new</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<link linkend="language.operators.logical">or</link>
|
|
</entry>
|
|
<entry>
|
|
<function>print</function>
|
|
</entry>
|
|
<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>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<link linkend="language.oop5.properties.readonly-properties">readonly</link> (as of PHP 8.1.0) *
|
|
</entry>
|
|
<entry>
|
|
<function>require</function>
|
|
</entry>
|
|
<entry>
|
|
<function>require_once</function>
|
|
</entry>
|
|
<entry>
|
|
<function>return</function>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.variables.scope">static</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<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>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.exceptions">try</link>
|
|
</entry>
|
|
<entry>
|
|
<function>unset</function>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<link linkend="language.namespaces">use</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.oop5.properties">var</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="control-structures.while">while</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.operators.logical">xor</link>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.generators">yield</link>
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
<link linkend="control-structures.yield.from">yield from</link>
|
|
</entry>
|
|
<entry></entry>
|
|
<entry></entry>
|
|
<entry></entry>
|
|
<entry></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
|
|
<simpara>
|
|
* <literal>readonly</literal> may be used as function name.
|
|
</simpara>
|
|
|
|
<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>
|
|
</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>
|
|
</entry>
|
|
<entry>
|
|
<link linkend="language.constants.predefined">__TRAIT__</link>
|
|
</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>
|
|
<varlistentry>
|
|
<term><classname>Exception</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>ErrorException</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>php_user_filter</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>Closure</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
The predefined final class <classname>Closure</classname>
|
|
is used for representing <link
|
|
linkend="functions.anonymous">anonymous functions</link>.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>Generator</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
The predefined final class <classname>Generator</classname>
|
|
is used for representing <link
|
|
linkend="language.generators">generators</link>.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>ArithmeticError</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>AssertionError</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>DivisionByZeroError</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>Error</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>Throwable</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>ParseError</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><classname>TypeError</classname></term>
|
|
<listitem>
|
|
<simpara>
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</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>
|
|
The following words cannot be used to name a class, interface or trait, and
|
|
they are also prohibited from being used in namespaces.
|
|
</simpara>
|
|
<para>
|
|
<table>
|
|
<title>Reserved words</title>
|
|
<tgroup cols="4">
|
|
<tbody>
|
|
<row>
|
|
<entry>
|
|
int
|
|
</entry>
|
|
<entry>
|
|
float
|
|
</entry>
|
|
<entry>
|
|
bool
|
|
</entry>
|
|
<entry>
|
|
string
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
true
|
|
</entry>
|
|
<entry>
|
|
false
|
|
</entry>
|
|
<entry>
|
|
null
|
|
</entry>
|
|
<entry>
|
|
void (as of PHP 7.1)
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>
|
|
iterable (as of PHP 7.1)
|
|
</entry>
|
|
<entry>
|
|
object (as of PHP 7.2)
|
|
</entry>
|
|
<entry>
|
|
mixed (as of PHP 8.0)
|
|
</entry>
|
|
<entry>
|
|
never (as of PHP 8.1)
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<para>
|
|
The following list of words have had soft reservations placed on them.
|
|
Whilst they may still be used as class, interface, and trait names (as well
|
|
as in namespaces), usage of them is highly discouraged since they may be
|
|
used in future versions of PHP.
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>Soft reserved words</title>
|
|
<tgroup cols="4">
|
|
<tbody>
|
|
<row>
|
|
<entry>
|
|
resource
|
|
</entry>
|
|
<entry>
|
|
numeric
|
|
</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
|
|
-->
|