PHP Array Functions

The array functions allow you to manipulate and access arrays. In PHP , the array functions are the part of the PHP core. There is no installation needed to use these functions.

Function Description
array() Create an array

array_change_key_case() Changes the case of all keys in an array.
array_chunk() Split an array into chunks of arrays
array_column() Return the values from a single column in the input array
array_combine() Creates an array by using one array for keys and another for its values
array_count_values() Counts all the values of an array
array_diff() Compare arrays values, and returns the differences
array_diff_assoc() Compare arrays keys and values, and returns the differences
array_diff_key() Compare arrays keys, and returns the differences
array_diff_uassoc() Compare arrays keys and values, using a user-defined key comparison function, and returns the differences
array_diff_ukey() Compare array keys, using a user-defined key comparison function, and returns the differences
array_fill() Fill an array with values
array_fill_keys() Fill an array with values, specifying keys
array_filter() Filters elements of an array using a user-defined function
array_flip() Flips or Exchanges all keys with their associated values in an array
array_intersect() Compare arrays values, and returns the matches
array_intersect_assoc() Compare arrays keys and values, and returns the matches
array_intersect_key() Compare arrays keys, and returns the matches
array_intersect_uassoc() Compare arrays keys and values, using a user-defined key comparison function, and returns the matches
array_intersect_ukey() Compare arrays keys, using a user-defined key comparison function, and returns the matches
array_keys() Return all the keys or a subset of the keys of an array
array_key_exists() Checks if the specified key exists in the array
array_map() Sends the elements of the given arrays to a user-defined function, which may use it to returns new values
array_merge() Merges one or more arrays into one array
array_merge_recursive() Merges one or more arrays into one array recursively
array_multisort() Sorts multiple or multi-dimensional arrays
array_pad() Inserts a specified number of items, with a specified value, to an array
array_pop() Removes the last element of an array, and returns the value of the removed element
array_product() Calculates the product of the values in an array
array_push() Inserts one or more elements to the end of an array
array_rand() Returns one or more random keys from an array
array_reduce() Reduce the array to a single value by using a user-defined callback function
array_replace() Replaces the values of the first array with the values from following arrays
array_replace_recursive() Replaces the values of the first array with the values from following arrays recursively
array_reverse() Return an array with elements in reverse order
array_search() Searches an array for a given value and returns the corresponding key if successful
array_shift() Removes the first element from an array, and returns the value of the removed element
array_slice() Extract a slice from an array
array_splice() Remove a portion of the array and replace it with something else
array_sum() Calculate the sum of values in an array
array_udiff() Compares only arrays values by using a user-defined comparison callback function, and returns the differences
array_udiff_assoc() Compares arrays values by using a user-defined comparison callback function, with additional keys comparison using an internal (or built-in) function, and returns the differences
array_udiff_uassoc() Compares arrays keys and values by using two separate user-defined comparison callback functions, and returns the differences
array_uintersect() Compares only arrays values by using a user-defined comparison callback function, and returns the matches
array_uintersect_assoc() Compares arrays values by using a user-defined comparison callback function, while uses an internal (or built-in) function for comparing the key, and returns the matches
array_uintersect_uassoc() Compares arrays keys and values by using two separate user-defined comparison callback functions, and returns the matches
array_unique() Removes duplicate values from an array
array_unshift() Adds one or more elements to the beginning of an array
array_values() Return all the values of an array
array_walk() Applies a user-defined function to each element of an array
array_walk_recursive() Applies a user-defined function recursively to each element of an array
asort() Sort an associative array by value, in ascending order
arsort() Sort an associative array by value, in reverse or descending order
compact() Create array containing variables and their values
count() Count all elements in an array
current() Return the current element in an array
each() Return the current key and value pair from an array and advance the array cursor
end() Sets the internal pointer of an array to its last element
extract() Import variables into the current symbol table from an array
in_array() Checks if a value exists in an array
key_exists() Checks if the specified key exists in the array. Alias of array_key_exists()
key() Fetches a key from an array
ksort() Sort an associative array by key, in ascending order
krsort() Sort an associative array by key, in reverse or descending order
list() Assign variables as if they were an array
natcasesort() Sort an array using a case insensitive “natural order” algorithm
natsort() Sort an array using a “natural order” algorithm
next() Advance the internal array pointer of an array
pos() Return the current element in an array. Alias of current()
prev() Rewind the internal array pointer
range() Create an array containing a range of elements
reset() Set the internal pointer of an array to its first element
rsort() Sort an array in reverse or descending order
shuffle() Shuffle an array
sizeof() Count all elements in an array. Alias of count()
sort() Sort an array in ascending order
uasort() Sort an array using a user-defined comparison function and maintain index association
uksort() Sort an array by keys using a user-defined comparison function.
usort() Sort an array by values using a user-defined comparison function

If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

7 thoughts on “PHP Array Functions

  1. слот демо

    Игровые автоматы — это одна из самых популярных игровых механик в индустрии азартных игр.
    Смысл этих игр состоит в выпадении символов, что создают комбинации.
    Любая такая игра имеет уникальные механики, многочисленные иконки и бонусные раунды, которые добавляют азарта.
    Игровые автоматы подразделяются на традиционные и современные, в которых встречаются разные уровни сложности.
    слот клипы
    Большинство пользователей предпочитают эти игры за интуитивность и способность увлечь без необходимости запоминать сложные комбинации.
    Новые игровые автоматы могут включать дополнительные бонусные игры, что привлекает новых пользователей.
    Как результат, игровые автоматы остаются одним из самых востребованных вариантов отдыха в индустрии ставок.

  2. DennisTak

    Программа видеонаблюдения – это современный инструмент для защиты имущества, объединяющий технологии и удобство использования .
    На сайте вы найдете подробное руководство по выбору и настройке систем видеонаблюдения, включая онлайн-хранилища, их преимущества и ограничения .
    Облачное видеонаблюдение
    Рассматриваются комбинированные системы, объединяющие локальное и удаленное хранение, что делает систему более гибкой и надежной .
    Важной частью является описание передовых аналитических функций , таких как определение активности, идентификация элементов и другие AI-технологии .

  3. RolandRob

    На данном сайте вы сможете найти подробную информацию о способах лечения депрессии у пожилых людей. Вы также узнаете здесь о профилактических мерах, современных подходах и рекомендациях специалистов.
    http://sportandpolitics.ukrbb.net/viewtopic.php?f=24&t=19706

  4. Snaptik

    Spot on with this write-up, I honestly believe that this site needs far more attention. I’ll probably be returning to read through more, thanks for the information.

  5. Craig

    Hey there! Do you know if they make any plugins to help with Search Engine Optimization?
    I’m trying to get my site to rank for some targeted keywords but I’m not seeing very
    good success. If you know of any please share. Kudos! I saw similar text
    here: Bij nl

  6. gsa ser list

    Heya i’m for the first time here. I came across this board and I find
    It truly useful & it helped me out a lot. I hope to give something back and aid others like you aided me.!

  7. PrestonX

    I see your blog needs some fresh posts. Writing manually takes a lot of time, but there is tool for
    this time consuming task, search for; unlimited content Wrastain’s tools

Leave a Reply

Your email address will not be published.