PHP: Hypertext Preprocessor (original) (raw)

Change language:

Predefined Constants

The constants below are always available as part of the PHP core.

[CASE_LOWER](array.constants.php#constant.case-lower) (int)

[CASE_LOWER](array.constants.php#constant.case-lower) is used witharray_change_key_case() and is used to convert array keys to lower case. This is also the default case forarray_change_key_case(). As of PHP 8.2.0, only ASCII characters will be converted.

[CASE_UPPER](array.constants.php#constant.case-upper) (int)

[CASE_UPPER](array.constants.php#constant.case-upper) is used witharray_change_key_case() and is used to convert array keys to upper case. As of PHP 8.2.0, only ASCII characters will be converted.

Sorting order flags:

[SORT_ASC](array.constants.php#constant.sort-asc) (int)

[SORT_ASC](array.constants.php#constant.sort-asc) is used witharray_multisort() to sort in ascending order.

[SORT_DESC](array.constants.php#constant.sort-desc) (int)

[SORT_DESC](array.constants.php#constant.sort-desc) is used witharray_multisort() to sort in descending order.

Sorting type flags: used by various sort functions

[SORT_REGULAR](array.constants.php#constant.sort-regular) (int)

[SORT_REGULAR](array.constants.php#constant.sort-regular) is used to compare items normally.

[SORT_NUMERIC](array.constants.php#constant.sort-numeric) (int)

[SORT_NUMERIC](array.constants.php#constant.sort-numeric) is used to compare items numerically.

[SORT_STRING](array.constants.php#constant.sort-string) (int)

[SORT_STRING](array.constants.php#constant.sort-string) is used to compare items as strings.

[SORT_LOCALE_STRING](array.constants.php#constant.sort-locale-string) (int)

[SORT_LOCALE_STRING](array.constants.php#constant.sort-locale-string) is used to compare items as strings, based on the current locale.

[SORT_NATURAL](array.constants.php#constant.sort-natural) (int)

[SORT_NATURAL](array.constants.php#constant.sort-natural) is used to compare items as strings using "natural ordering" like natsort().

[SORT_FLAG_CASE](array.constants.php#constant.sort-flag-case) (int)

[SORT_FLAG_CASE](array.constants.php#constant.sort-flag-case) can be combined (bitwise OR) with**[SORT_STRING](array.constants.php#constant.sort-string)** or [SORT_NATURAL](array.constants.php#constant.sort-natural) to sort strings case-insensitively. As of PHP 8.2.0, only ASCII case folding will be done.

Filter flags:

[ARRAY_FILTER_USE_KEY](array.constants.php#constant.array-filter-use-key) (int)

[ARRAY_FILTER_USE_KEY](array.constants.php#constant.array-filter-use-key) is used witharray_filter() to pass each key as the first argument to the given callback function.

[ARRAY_FILTER_USE_BOTH](array.constants.php#constant.array-filter-use-both) (int)

[ARRAY_FILTER_USE_BOTH](array.constants.php#constant.array-filter-use-both) is used witharray_filter() to pass both value and key to the given callback function.

[COUNT_NORMAL](array.constants.php#constant.count-normal) (int)

[COUNT_RECURSIVE](array.constants.php#constant.count-recursive) (int)

[EXTR_OVERWRITE](array.constants.php#constant.extr-overwrite) (int)

[EXTR_SKIP](array.constants.php#constant.extr-skip) (int)

[EXTR_PREFIX_SAME](array.constants.php#constant.extr-prefix-same) (int)

[EXTR_PREFIX_ALL](array.constants.php#constant.extr-prefix-all) (int)

[EXTR_PREFIX_INVALID](array.constants.php#constant.extr-prefix-invalid) (int)

[EXTR_PREFIX_IF_EXISTS](array.constants.php#constant.extr-prefix-if-exists) (int)

[EXTR_IF_EXISTS](array.constants.php#constant.extr-if-exists) (int)

[EXTR_REFS](array.constants.php#constant.extr-refs) (int)

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug

+add a note

User Contributed Notes

There are no user contributed notes for this page.