vrana Wed Aug 18 07:35:32 2004 EDT
Modified files:
/phpdoc/en/reference/info/functions get-defined-constants.xml
Log:
Categorize parameter
# Please check my grammar
http://cvs.php.net/diff.php/phpdoc/en/reference/info/functions/get-defined-constants.xml?r1=1.7&r2=1.8&ty=u
Index: phpdoc/en/reference/info/functions/get-defined-constants.xml
diff -u phpdoc/en/reference/info/functions/get-defined-constants.xml:1.7
phpdoc/en/reference/info/functions/get-defined-constants.xml:1.8
--- phpdoc/en/reference/info/functions/get-defined-constants.xml:1.7 Mon Aug 2
05:32:13 2004
+++ phpdoc/en/reference/info/functions/get-defined-constants.xml Wed Aug 18
07:35:32 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/info.xml, last change in rev 1.71 -->
<refentry id="function.get-defined-constants">
<refnamediv>
@@ -13,7 +13,7 @@
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>get_defined_constants</methodname>
- <void/>
+ <methodparam
choice="opt"><type>mixed</type><parameter>categorize</parameter></methodparam>
</methodsynopsis>
<para>
This function returns the names and values of all the constants
@@ -55,6 +55,69 @@
]]>
</screen>
</informalexample>
+ </para>
+ <para>
+ As of PHP 5, you can pass an optional parameter
+ <parameter>categorize</parameter> causing that this function will return
+ multi-dimensional array with categories in keys of the first dimension and
+ constants and their values in the second dimension.
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+define("MY_CONSTANT", 1);
+print_r(get_defined_constants(true));
+?>
+]]>
+ </programlisting>
+ &example.outputs.similar;
+ <screen>
+<![CDATA[
+Array
+(
+ [internal] => Array
+ (
+ [E_ERROR] => 1
+ [E_WARNING] => 2
+ [E_PARSE] => 4
+ [E_NOTICE] => 8
+ [E_CORE_ERROR] => 16
+ [E_CORE_WARNING] => 32
+ [E_COMPILE_ERROR] => 64
+ [E_COMPILE_WARNING] => 128
+ [E_USER_ERROR] => 256
+ [E_USER_WARNING] => 512
+ [E_USER_NOTICE] => 1024
+ [E_ALL] => 2047
+ [TRUE] => 1
+ )
+
+ [pcre] => Array
+ (
+ [PREG_PATTERN_ORDER] => 1
+ [PREG_SET_ORDER] => 2
+ [PREG_OFFSET_CAPTURE] => 256
+ [PREG_SPLIT_NO_EMPTY] => 1
+ [PREG_SPLIT_DELIM_CAPTURE] => 2
+ [PREG_SPLIT_OFFSET_CAPTURE] => 4
+ [PREG_GREP_INVERT] => 1
+ )
+
+ [user] => Array
+ (
+ [MY_CONSTANT] => 1
+ )
+
+)
+]]>
+ </screen>
+ </informalexample>
+ <note>
+ <para>
+ Value of the <parameter>categorize</parameter> parameter is irrelevant,
+ only presence is considered.
+ </para>
+ </note>
</para>
<para>
See also