[Editorial note: parent and self are reserved class names. Functions and constants with their names can be declared, but not userspace classes]
true, false and null are not listed because they are globally-defined constants, not reserved words.
No idea about parent or self, though.
Lista de Palabras Reservadas
Table of Contents
El siguiente es un listado de identificadores predefinidos en PHP. Ninguno de los identificadores listados aquí debe ser usado como identificador en alguno de sus scripts. Estas listas incluyen palabras clave y nombres de variable, constantes y clases predefinidas. Estas listas no son ni exhaustivas ni completas.
Lista de Palabras Clave
Estas palabras tienen un significado especial en PHP. Algunas de ellas representan cosas que lucen como funciones, o algunas se ven como constantes, y así sucesivamente--pero no lo son, en realidad: son construcciones del lenguaje. Usted no puede usar ninguna de las siguientes palabras como constantes, nombres de clase, nombres de funciones o métodos. Usarlas como nombres de variables está bien, generalmente, pero puede conducir a confusiones.
| and | or | xor | __FILE__ | exception (PHP 5) |
| __LINE__ | array() | as | break | case |
| class | const | continue | declare | default |
| die() | do | echo() | else | elseif |
| empty() | enddeclare | endfor | endforeach | endif |
| endswitch | endwhile | eval() | exit() | extends |
| for | foreach | function | global | if |
| include() | include_once() | isset() | list() | new |
| print() | require() | require_once() | return() | static |
| switch | unset() | use | var | while |
| __FUNCTION__ | __CLASS__ | __METHOD__ | final (a partir de PHP 5) | php_user_filter (a partir de PHP 5) |
| interface (a partir de PHP 5) | implements (a partir de PHP 5) | instanceof (a partir de PHP 5) | public (a partir de PHP 5) | private (a partir de PHP 5) |
| protected (a partir de PHP 5) | abstract (a partir de PHP 5) | clone (a partir de PHP 5) | try (a partir de PHP 5) | catch (a partir de PHP 5) |
| throw (a partir de PHP 5) | cfunction (PHP 4 únicamente) | old_function (PHP 4 únicamente) | this (a partir de PHP 5) | final (a partir de PHP 5) |
| __NAMESPACE__ (a partir de PHP 5.3) | namespace (a partir de PHP 5.3) | goto (PHP 6 únicamente) | __DIR__ (a partir de PHP 5.3) |
Lista de Palabras Reservadas
04-Oct-2007 11:53
05-Mar-2007 03:14
Naming a PHP5 class "variant" (with a constructor called the same) and then making an instance of it using __autoload triggers an error which disappears as soon as the name is changed. This should mean that "variant" is also a reserved word.
Two things:
1. It would be nice for this list to differentiate those reserved words, which are language constructs used *with* parentheses (isset, unset, empty, eval, exit, die, ...) and those rather to be used *without* parentheses (all includes, echo, print, return, ...?)
This would really help define some common coding styles...
2. Do you write NULL, TRUE, FALSE or null, true, false? (I find CAPITAL letters better, however typing them can be annoying so I stick with using all lowercase letters, but what's the standard?)
I don't see the boolean constants 'true' and 'false' listed among the reserved words/keywords/constants.
