xref: /php-src/ext/standard/php_array.h (revision 79133df1)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Andi Gutmans <andi@php.net>                                 |
14    |          Zeev Suraski <zeev@php.net>                                 |
15    |          Rasmus Lerdorf <rasmus@php.net>                             |
16    |          Andrei Zmievski <andrei@php.net>                            |
17    +----------------------------------------------------------------------+
18 */
19 
20 #ifndef PHP_ARRAY_H
21 #define PHP_ARRAY_H
22 
23 # include "ext/random/php_random.h"
24 
25 PHP_MINIT_FUNCTION(array);
26 PHP_MSHUTDOWN_FUNCTION(array);
27 
28 PHPAPI int php_array_merge(HashTable *dest, HashTable *src);
29 PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src);
30 PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src);
31 PHPAPI int php_multisort_compare(const void *a, const void *b);
32 PHPAPI zend_long php_count_recursive(HashTable *ht);
33 
34 PHPAPI bool php_array_data_shuffle(php_random_algo_with_state engine, zval *array);
35 PHPAPI bool php_array_pick_keys(php_random_algo_with_state engine, zval *input, zend_long num_req, zval *retval, bool silent);
36 
37 #define PHP_EXTR_OVERWRITE			0
38 #define PHP_EXTR_SKIP				1
39 #define PHP_EXTR_PREFIX_SAME		2
40 #define PHP_EXTR_PREFIX_ALL			3
41 #define PHP_EXTR_PREFIX_INVALID		4
42 #define PHP_EXTR_PREFIX_IF_EXISTS	5
43 #define PHP_EXTR_IF_EXISTS			6
44 
45 #define PHP_EXTR_REFS				0x100
46 
47 #define PHP_CASE_LOWER				0
48 #define PHP_CASE_UPPER				1
49 
50 #define PHP_SORT_REGULAR            0
51 #define PHP_SORT_NUMERIC            1
52 #define PHP_SORT_STRING             2
53 #define PHP_SORT_DESC               3
54 #define PHP_SORT_ASC                4
55 #define PHP_SORT_LOCALE_STRING      5
56 #define PHP_SORT_NATURAL            6
57 #define PHP_SORT_FLAG_CASE          8
58 
59 #define PHP_COUNT_NORMAL      0
60 #define PHP_COUNT_RECURSIVE   1
61 
62 #define ARRAY_FILTER_USE_BOTH	1
63 #define ARRAY_FILTER_USE_KEY	2
64 
65 ZEND_BEGIN_MODULE_GLOBALS(array)
66 	bucket_compare_func_t *multisort_func;
67 	bool compare_deprecation_thrown;
68 ZEND_END_MODULE_GLOBALS(array)
69 
70 #define ARRAYG(v) ZEND_MODULE_GLOBALS_ACCESSOR(array, v)
71 
72 #endif /* PHP_ARRAY_H */
73