Predefined Constants
The constants below are always available as part of the PHP core.
-
CASE_LOWER
(integer) -
CASE_LOWER
is used with array_change_key_case() and is used to convert array keys to lower case. This is also the default case for array_change_key_case(). -
CASE_UPPER
(integer) -
CASE_UPPER
is used with array_change_key_case() and is used to convert array keys to upper case.
Sorting order flags:
-
SORT_ASC
(integer) -
SORT_ASC
is used with array_multisort() to sort in ascending order. -
SORT_DESC
(integer) -
SORT_DESC
is used with array_multisort() to sort in descending order.
Sorting type flags: used by various sort functions
-
SORT_REGULAR
(integer) -
SORT_REGULAR
is used to compare items normally. -
SORT_NUMERIC
(integer) -
SORT_NUMERIC
is used to compare items numerically. -
SORT_STRING
(integer) -
SORT_STRING
is used to compare items as strings. -
SORT_LOCALE_STRING
(integer) -
SORT_LOCALE_STRING
is used to compare items as strings, based on the current locale. Added in PHP 5.0.2. -
SORT_NATURAL
(integer) -
SORT_NATURAL
is used to compare items as strings using "natural ordering" like natsort(). Added in PHP 5.4.0. -
SORT_FLAG_CASE
(integer) -
SORT_FLAG_CASE
can be combined (bitwise OR) withSORT_STRING
orSORT_NATURAL
to sort strings case-insensitively. Added in PHP 5.4.0.
Filter flags:
-
ARRAY_FILTER_USE_KEY
(integer) -
ARRAY_FILTER_USE_KEY
is used with array_filter() to pass each key as the first argument to the given callback function. Added in PHP 5.6.0. -
ARRAY_FILTER_USE_BOTH
(integer) -
ARRAY_FILTER_USE_BOTH
is used with array_filter() to pass both value and key to the given callback function. Added in PHP 5.6.0.
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-array.constants.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.