PHP Developer’s Dictionary IT-SC book 120 The array_values() function returns all the values (not keys) of the input array. array_walk() Syntax int array_walk(array arr, string func, mixed userdata) Description The array_walk() function , which was added in PHP 3.0.3 and PHP 4.0, executes the function func with each element in the array. Each func call will have the array value as the first parameter and the array key as the second parameter. When userdata is present, it will be passed as the third parameter to func . Note that when func encounters errors, a warning will be generated each time. To suppress these warnings, call array_walk() with an @ sign in front of it. Also, array_walk() doesn't reset the array by default, so you might need to call reset() between subsequent calls of array_walk() . arsort() Syntax void arsort(array array) Description The arsort() function sorts the array in reverse order, based on the values in the array with the corresponding indices (keys) being maintained. $array1 = array("c"=>"1","b"=>"2","a"=>"3"); arsort($array1);//array1 = ("a"=>"3","b"=>"2","c"=>"1") asort() Syntax void asort(array array) Description PHP Developer’s Dictionary IT-SC book 121 The asort() function sorts the array based on the values in the array with the corresponding indices (keys) being maintained. $array1 = array("a"=>"3","b"=>"2","c"=>"1"); asort($array1);//array1 = ("c"=>"1","b"=>"2","a"=>"3") compact() Syntax array compact(string varname | array varnames, [ ] ) Description The array_compact() function, which was added in PHP 4.0, takes both names of variables and arrays that contain the names of variables, and looks up these variable names in the current symbol table. Each variable name becomes a key and the variable's content becomes the value for a new array, which is created and returned. count() Syntax int count(mixed var) Description The count() function returns the number of elements in var which is typically an array. If var is not an array, the function will return 1 ; if var is not set, count() will return 0. current() Syntax mixed current(array array) Description PHP Developer’s Dictionary IT-SC book 122 The current() function returns the element in array that is currently being pointed to by an internal pointer. Every array has this internal pointer, which is initialized to point to the first element of the array. If the internal pointer points beyond the element list, the function returns false. each() Syntax array each(array array) Description The each() function returns the current key and value pair from array and advances the internal pointer to the next key and value pair. The return array consists of four elements, where the elements are comprised of the keys: 0, 1, key, and value. Elements 0 and key contain the key name of the current array element, and 1 and value contain the data. If the internal pointer for array extends past the end of array 's contents, each() returns false. end() Syntax end(array array) Description The end() function moves the internal pointer for array to the last element in array . extract() Syntax void extract(array var_array, int [extract_type] , string [prefix] ) Description The extract() function, which was added in PHP 3.0.7 and PHP 4.0, imports variables from an array into the current symbol table. It examines var_array and PHP Developer’s Dictionary IT-SC book 123 takes its keys as variable names and its values as the corresponding variable values. Each key/value pair will result in one new entry in the symbol table. In the case where a collision occurs (the variable already exists in the symbol table), the extract_type is taken into consideration. The possible values for extract_type are EXTR_OVERWRITE— Results in existing variables being overwritten EXTR_SKIP—Results in the existing variable value being preserved in the symbol table EXTR_PREFIX_SAME— Results in the new variable being inserted into the symbol table with prefix prepended to the variable name EXTR_PREFIX_ALL—Results in all new variables in the symbol table being prefixed with prefix prefix defaults to EXTR_OVERWRITE . EXTR_OVERWRITE and EXTR_SKIP don't require a specified prefix value. in_array() Syntax bool in_array(mixed needle, array haystack) Description The in_array() function, which was added in PHP 4.0, searches for needle in haystack and returns true if the needle is found. $array1 = array(1,2,3,4,5); echo in_array(3,$array1);//displays 1 key() Syntax mixed key(array array) Description The key() function returns the index element of the current array position that is pointed to by the internal pointer. PHP Developer’s Dictionary IT-SC book 124 krsort() Syntax int krsort(array array ) Description The krsort() function, which was added in PHP 3.0.13 and PHP 4.0, sorts the array in reverse order based on the keys. Key and value pairs are maintained. $array1 = array("a"=>"3","b"=>"2","c"=>"1"); krsort($array1);//array1 = ("c"=>"1","b"=>"2","a"=>"3") ksort() Syntax int ksort(array array) Description The ksort() function sorts the array based on the keys. Key and value pairs are maintained. $array1 = array("c"=>"1","b"=>"2","a"=>"3"); ksort($array1);//array1 = ("a"=>"3","b"=>"2","c"=>"1") list() Syntax void list( ) Description . extract() function, which was added in PHP 3.0.7 and PHP 4.0, imports variables from an array into the current symbol table. It examines var_array and PHP Developer’s Dictionary IT-SC book. internal pointer. PHP Developer’s Dictionary IT-SC book 124 krsort() Syntax int krsort(array array ) Description The krsort() function, which was added in PHP 3.0.13 and PHP 4.0, sorts. string func, mixed userdata) Description The array_walk() function , which was added in PHP 3.0.3 and PHP 4.0, executes the function func with each element in the array. Each func call will