Advanced Array function


No. 
Function
 Defined
1
print_r ($ array)
View the structure of the array
2
count ($ array)
Returns the integer value is the number of array elements
3
array_values ​​($ array)
Returns an array constant is the element value is the value derived from elements of the array $ array
4
array_keys ($ array)
Returns an array constant is the element whose value is derived from key elements of the array $ array.
5
array_pop ($ array)
Removes the last element of the array. The function returns the last element is removed.
6
array_push ($ array, $ VAL1, $ val2, ..., $ valn)
Add one or more elements at the end of the array $ array. The function returns the integer is the number of elements of the new array $ array
7
array_shift ($ array)
Removes the first element of the array. The function returns the first element is removed.
8
array_unshift ($ array, $ VAL1, $ val2, ..., $ valn)
Add one or more of the first array element in $ array. The function returns the integer is the number of elements of the new array $ array
9
array_flip ($ array)
Returns an array of keys and values ​​are interchangeable with the array $ array (lock and key values ​​into the value)
10
sort ($ array)
Sort array $ array as the value increases
11
array_reverse ($ array)
Reverse the position of the array elements
12
array_merge ($ array1, $ array2, ..., $ arrayn)
Enter two or more arrays into a single array and returns a new array
13
array_rand
($ Array, $ number)
Get $ number random element from the array $ array and put in new film (get key value)
14
array_search
($ Value, $ array)
Find the element value in array $ array $ value. Returns the key of the element found.
15
array_slice
($ Array, $ begin. $ Finish)
Extracting an element of the array $ array from location to location $ $ begin finish. The first element (index 0), the last element (index -1 or count ($ array) - 1)
16
array_unique ($ array)
Eliminate duplicate elements in the array and returns a new array
17
implode ($ str, $ array)
Transfer the values ​​of the array $ array into a string consists of elements separated by the character $ str
18
explode ($ delimiter, $ str)
Move a string into an array. Split the string based on $ delimiter, each team will split into a new element is
19
serialize ($ value)
Move string / array / object $ value to a string to save into a special database
20
unserialize ($ value)
Transfer special string is generated from serialize ($ value) on initial state
21
array_key_exists
($ Key, $ array)
Check the key $ key exists in the array $ array or not? If the return value is true.
22
in_array ($ value, $ array)
$ Value Test value exists in the array $ array or not? If the return value is true.
23
array_diff
($ Array1, $ array2)
Returns an array consists of elements of value exist in the array $ array1 but does not exist in the array $ array2
24
array_diff_assoc
($ Array1, $ array2)
Returns an array includes the key elements exist in the array $ array1 but does not exist in the array $ array2
25
array_intersect
($ Array1, $ array2)
Returns an array includes the same elements of value between the two array $ array1 and $ array2
26
array_intersect_assoc
($ Array1, $ array2)
Returns an array includes the same elements of keys and values ​​between two array $ array1 and $ array2
27
array_combine
($ Keys, $ values)
Create a new array with keys taken from the array $ keys and values ​​are taken from the array $ values ​​sequentially (required number of elements in two arrays must be equal)


No comments:

Post a Comment