From a15274f4d1d85a1c9e28cac42a9fd3cd78d134fc Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Fri, 21 May 2004 04:55:23 +0000 Subject: [PATCH] added an example about valid and invalid constant names # but every name is valid in fact.. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@159220 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/constants.xml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/language/constants.xml b/language/constants.xml index ae6e3e2619..e0e9507e3b 100644 --- a/language/constants.xml +++ b/language/constants.xml @@ -1,5 +1,5 @@ - + Constants @@ -17,8 +17,31 @@ by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thusly: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* + + + + Valid and invalid constant names + + +// Valid constant names +define("foo", "something"); +define("foo2", "something else"); +define("foo_bar", "something more") + +// Invalid constant names +define("2foo", "something"); + +// This is valid, but should be avoided: +// PHP may one day provide a magical constant +// that will break your script +define("__foo__", "something"); + +?> +]]> + +