php-array-functions

PHP Array Functions

avatar
EknowledgePoint

Increase Your Knowledge with us


  • Nov 15, 2022
  • 5 min read
  • 266
  • 2344 Views

The array functions allow you to access and manipulate arrays.

Few Important functions: is_array(), explode(), implode(), preg_split(), and unset().

Sr no Function Feature
1 array_change_key_case   Changes the case of all keys in an array
2 array_chunk   Split an array into chunks
3 array_column   Return the values from a single column in the input array
4 array_combine   Creates an array by using one array for keys and another for its values
5 array_count_values   Counts all the values of an array
6 array_diff_assoc   Computes the difference of arrays with additional index check
7 array_diff_key   Computes the difference of arrays using keys for comparison
8 array_diff_uassoc   Computes the difference of arrays with additional index check which is performed by a user supplied callback function
9 array_diff_ukey   Computes the difference of arrays using a callback function on the keys for comparison
10 array_diff   Computes the difference of arrays
11 array_fill_keys   Fill an array with values, specifying keys
12 array_fill   Fill an array with values
13 array_filter   Filters elements of an array using a callback function
14 array_flip   Exchanges all keys with their associated values in an array
15 array_intersect_assoc   Computes the intersection of arrays with additional index check
16 array_intersect_key   Computes the intersection of arrays using keys for comparison
17 array_intersect_uassoc   Computes the intersection of arrays with additional index check, compares indexes by a callback function
18 array_intersect_ukey   Computes the intersection of arrays using a callback function on the keys for comparison
19 array_intersect   Computes the intersection of arrays
20 array_is_list   Checks whether a given array is a list
21 array_key_exists   Checks if the given key or index exists in the array
22 array_key_first   Gets the first key of an array
23 array_key_last   Gets the last key of an array
24 array_keys   Return all the keys or a subset of the keys of an array
25 array_map   Applies the callback to the elements of the given arrays
26 array_merge_recursive   Merge one or more arrays recursively
27 array_merge   Merge one or more arrays
28 array_multisort   Sort multiple or multi-dimensional arrays
29 array_pad   Pad array to the specified length with a value
30 array_pop   Pop the element off the end of array
31 array_product   Calculate the product of values in an array
32 array_push   Push one or more elements onto the end of array
33 array_rand   Pick one or more random keys out of an array
34 array_reduce   Iteratively reduce the array to a single value using a callback function
35 array_replace_recursive   Replaces elements from passed arrays into the first array recursively
36 array_replace   Replaces elements from passed arrays into the first array
37 array_reverse   Return an array with elements in reverse order
38 array_search   Searches the array for a given value and returns the first corresponding key if successful
39 array_shift   Shift an element off the beginning of array
40 array_slice   Extract a slice of the array
41 array_splice   Remove a portion of the array and replace it with something else
42 array_sum   Calculate the sum of values in an array
43 array_udiff_assoc   Computes the difference of arrays with additional index check, compares data by a callback function
44 array_udiff_uassoc   Computes the difference of arrays with additional index check, compares data and indexes by a callback function
45 array_udiff   Computes the difference of arrays by using a callback function for data comparison
46 array_uintersect_assoc   Computes the intersection of arrays with additional index check, compares data by a callback function
47 array_uintersect_uassoc   Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions
48 array_uintersect   Computes the intersection of arrays, compares data by a callback function
49 array_unique   Removes duplicate values from an array
50 array_unshift   Prepend one or more elements to the beginning of an array
51 array_values   Return all the values of an array
52 array_walk_recursive   Apply a user function recursively to every member of an array
53 array_walk   Apply a user supplied function to every member of an array
54 array   Create an array
55 arsort   Sort an array in descending order and maintain index association
56 asort   Sort an array in ascending order and maintain index association
57 compact   Create array containing variables and their values
58 count   Counts all elements in an array or in a Countable object
59 current   Return the current element in an array
60 each   Return the current key and value pair from an array and advance the array cursor
61 end   Set the internal pointer of an array to its last element
62 extract   Import variables into the current symbol table from an array
63 in_array   Checks if a value exists in an array
64 key_exists   Alias of array_key_exists
65 key   Fetch a key from an array
66 krsort   Sort an array by key in descending order
67 ksort   Sort an array by key in ascending order
68 list   Assign variables as if they were an array
69 natcasesort   Sort an array using a case insensitive "natural order" algorithm
70 natsort   Sort an array using a "natural order" algorithm
71 next   Advance the internal pointer of an array
72 pos   Alias of current
73 prev   Rewind the internal array pointer
74 range   Create an array containing a range of elements
75 reset   Set the internal pointer of an array to its first element
76 rsort   Sort an array in descending order
77 shuffle   Shuffle an array
78 sizeof   Alias of count
79 sort   Sort an array in ascending order
80 uasort   Sort an array with a user-defined comparison function and maintain index association
81 uksort   Sort an array by keys using a user-defined comparison function
82 usort   Sort an array by values using a user-defined comparison function

avatar

EknowledgePoint

Increase Your Knowledge with us
View Articles

EknowledgePoint is an innovative online learning platform that aims to democratize education by providing a vast array of courses and educational content to learners of all ages and backgrounds. It offers a diverse range of subjects, from academic topics to practical skills, making it a one-stop destination for anyone looking to expand their knowledge base.


5 comments

avatar
Shubham
June 11, 2024 at 6:01 am Reply

Knowledge is the fuel that powers our journey through life. It's platforms like EknowledgePoint that transform information into enlightenment, curiosity into competence, and dreams into reality. Embrace the opportunity to learn, and you'll find that the doors of possibility swing wide open. 🚀💡 #EknowledgePoint.

avatar
EknowledgePoint
June 11, 2024 at 6:55 am Reply

Thank you for your kind words! At EknowledgePoint, we are dedicated to empowering individuals on their learning journey. Your enthusiasm for knowledge and personal growth inspires us to keep providing the best educational resources and experiences. Let's continue to explore and learn together!.

avatar
Shubham
June 11, 2024 at 7:10 am Reply

Thanks For Your Support.

avatar
Neha
June 14, 2024 at 12:35 pm Reply

"I'm constantly amazed by the quality of instructors on EknowledgePoint. Learning from experts in their fields is both enlightening and empowering. 🌟👨‍🏫 #EknowledgePoint.

avatar
Nitin
June 18, 2024 at 11:55 am Reply

EknowledgePoint isn't just a platform; it's a community of learners. The support and camaraderie here are truly inspiring. 🤝🌍 #EknowledgePoint.

Leave a reply

Your email address will not be published. Required fields are marked *

Share this article