mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Categorize parameter
# Please check my grammar git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166662 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
3d2caccec6
commit
34f1e53f1b
1 changed files with 65 additions and 2 deletions
|
@ -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
|
||||
|
@ -56,6 +56,69 @@ Array
|
|||
</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
|
||||
<function>defined</function>,
|
||||
|
|
Loading…
Reference in a new issue