PHP list() Function
The list() function is used to assign values to a list of variables. Like array(), this is not really a function, but a language construct. list() is used to assign a list of variables in one operation. Note: This function…
The list() function is used to assign values to a list of variables. Like array(), this is not really a function, but a language construct. list() is used to assign a list of variables in one operation. Note: This function…
The ksort() function sorts an array by key, maintaining key to data correlations. This is useful mainly for associative arrays. Tip: Use the krsort() function to sort an associative array in descending order, according to the key. Tip: Use the…
The krsort() function sorts an associative array in descending order, according to the key. Tip: Use the ksort() function to sort an associative array in ascending order, according to the key. Tip: Use the arsort() function to sort an associative…
The key() function is used to get the index element of the current array position. This function returns FALSE on error. Returns the key of the array element that is currently being pointed to by the internal pointer Parameter Description…
The in_array() function searches an array for a specific value. If the third parameter strict is set to TRUE then the in_array() function will also check the types of the $value. Note: If the search parameter is a string and…
This function is used to import variables from an array into the current symbol table. It takes an associative array array and treats keys as variable names and values as variable values. For each key/value pair it will create a…
The end() function is used to move the internal pointer of an array to its last element. The value of the last element of array1. Value Type : Mixed*. *Mixed : Mixed indicates multiple (but not necessarily all) types. Parameter…
The each() function returns the current element key and value, and moves the internal pointer forward. Note: After each() has executed, the array cursor will be left on the next element of the array, or past the last element if…
The current() function is used to fetch the value of the current element in an array. Every array has an internal pointer to its “current” element, which is initialized to the first element inserted into the array. Tip: This function…
You can use the PHP count() or sizeof() function to get the number of elements or values in an array. The count() and sizeof() function returns 0 for a variable that has been initialized with an empty array, but it…