Array, taulukko-funktiot

Erilaisia taulukoiden käsittelyyn liittyviä funktiota.


Funktio Selite Esimerkki
array() Luo taulukon, "array:n" Esim
array_change_key_case() Muuttaa taulukon solun nimet pienistä kirjaimista suuriksi Esim
array_chunk() Yhdistää yksiuloitteiset taulukot kaksiuloitteiseksi, jossa toisesta taulukosta tulee solujen nimet ja toisesta sisältö. Esim
array_column() Palauttaa arvot kaksiuloitteisesta taulukosta valitun sarakkeen arvot esim näytettäväksi tai laskentaan. Esim
array_combine() Luo kahdesta yksiuloitteisesta yhdistelmän. Esimerkiksi yhdistää solujen nimiä sisältävän taulukon varinaisen sisällön sisältävän taulukkon uudeksi taulukoksi. Esim
array_count_values() Laskee samanlaisten arvojen esiintymiskerrat taulukossa. Esimerkiksi taulukosta voidaan etsiä yhtäsuuret numeroarvot. Esim
array_diff() Vertailee kahden taulukon sisältöä keskenään, ja palauttaa sisällön erilaiset tiedot, esim solun nimen sekä sisällön. Esim
array_diff_assoc() Vertailee kahden taulukon solujen nimiä ja sisältöä keskenään, ja palauttaa sisällön erilaiset tiedot, esim solun nimen sekä sisällön. Esim
array_diff_key() Vertailee kahden taulukon solujen nimiä keskenään, ja palauttaa sisällön erilaiset tiedot, esim solun nimen sekä sisällön. Esim
array_diff_uassoc() Compare arrays, and returns the differences (compare keys and values, using a user-defined key comparison function) Esim
array_diff_ukey() Compare arrays, and returns the differences (compare keys only, using a user-defined key comparison function) Esim
array_fill() Fills an array with values Esim
array_fill_keys() Fills an array with values, specifying keys Esim
array_filter() Filters the values of an array using a callback function Esim
array_flip() Flips/Exchanges all keys with their associated values in an array Esim
array_intersect() Compare arrays, and returns the matches (compare values only) Esim
array_intersect_assoc() Compare arrays and returns the matches (compare keys and values) Esim
array_intersect_key() Compare arrays, and returns the matches (compare keys only) Esim
array_intersect_uassoc() Compare arrays, and returns the matches (compare keys and values, using a user-defined key comparison function) Esim
array_intersect_ukey() Compare arrays, and returns the matches (compare keys only, using a user-defined key comparison function) Esim
array_key_exists() Checks if the specified key exists in the array Esim
array_keys() Returns all the keys of an array Esim
array_map() Sends each value of an array to a user-made function, which returns new values Esim
array_merge() Merges one or more arrays into one array Esim
array_merge_recursive() Merges one or more arrays into one array recursively Esim
array_multisort() Sorts multiple or multi-dimensional arrays Esim
array_pad() Inserts a specified number of items, with a specified value, to an array Esim
array_pop() Deletes the last element of an array Esim
array_product() Calculates the product of the values in an array Esim
array_push() Inserts one or more elements to the end of an array Esim
array_rand() Returns one or more random keys from an array Esim
array_reduce() Returns an array as a string, using a user-defined function Esim
array_replace() Replaces the values of the first array with the values from following arrays Esim
array_replace_recursive() Replaces the values of the first array with the values from following arrays recursively Esim
array_reverse() Returns an array in the reverse order Esim
array_search() Searches an array for a given value and returns the key Esim
array_shift() Removes the first element from an array, and returns the value of the removed element Esim
array_slice() Returns selected parts of an array Esim
array_splice() Removes and replaces specified elements of an array Esim
array_sum() Returns the sum of the values in an array Esim
array_udiff() Compare arrays, and returns the differences (compare values only, using a user-defined key comparison function) Esim
array_udiff_assoc() Compare arrays, and returns the differences (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values) Esim
array_udiff_uassoc() Compare arrays, and returns the differences (compare keys and values, using two user-defined key comparison functions) Esim
array_uintersect() Compare arrays, and returns the matches (compare values only, using a user-defined key comparison function) Esim
array_uintersect_assoc() Compare arrays, and returns the matches (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values) Esim
array_uintersect_uassoc() Compare arrays, and returns the matches (compare keys and values, using two user-defined key comparison functions) Esim
array_unique() Removes duplicate values from an array Esim
array_unshift() Adds one or more elements to the beginning of an array Esim
array_values() Returns all the values of an array Esim
array_walk() Applies a user function to every member of an array Esim
array_walk_recursive() Applies a user function recursively to every member of an array Esim
arsort() Sorts an associative array in descending order, according to the value Esim
asort() Sorts an associative array in ascending order, according to the value Esim
compact() Create array containing variables and their values Esim
count() Returns the number of elements in an array Esim
current() Returns the current element in an array Esim
each() Returns the current key and value pair from an array Esim
end() Sets the internal pointer of an array to its last element Esim
extract() Imports variables into the current symbol table from an array Esim
in_array() Checks if a specified value exists in an array Esim
key() Fetches a key from an array Esim
krsort() Sorts an associative array in descending order, according to the key Esim
ksort() Sorts an associative array in ascending order, according to the key Esim
list() Assigns variables as if they were an array Esim
natcasesort() Sorts an array using a case insensitive "natural order" algorithm Esim
natsort() Sorts an array using a "natural order" algorithm Esim
next() Advance the internal array pointer of an array Esim
pos() Alias of current() Esim
prev() Rewinds the internal array pointer Esim
range() Creates an array containing a range of elements Esim
reset() Sets the internal pointer of an array to its first element Esim
rsort() Sorts an indexed array in descending order Esim
shuffle() Shuffles an array Esim
sizeof() Alias of count() Esim
sort() Sorts an indexed array in ascending order Esim
uasort() Sorts an array by values using a user-defined comparison function Esim
uksort() Sorts an array by keys using a user-defined comparison function Esim
usort() Sorts an array using a user-defined comparison function Esim