Describes several PHP4 "array" functions that are useful in 1 void extract (array var_array [, int extract_type] [, string prefix]]) to expand an associative array to the value of the variable name and variable, and if there is a conflict, the The following parameters specify the processing Method! Such as:
"Blue", "size" = "medium", "shape" = "sphere"); Extract ($var _array, Extr_prefix_same, "WDDX"); Print "$color, $size, $shape, $wddx _sizen";?> 2 Array compact (mixed varname [, mixed ...]) In contrast to the above function, save the variable name and the value of the variable in the associative array Surface! such as: $city = "San Francisco"; $state = "CA"; $event = "SIGGRAPH"; $location _vars = Array ("City", "state"); $result = Compact ("event", "Nothing_here", $location _vars); The $result result is an array ("event" = "SIGGRAPH", "City" = "San Francisco", "state" and "CA"). 3 bool In_array (mixed needle, array haystack) determine if there is a value in the array 4 void Natsort (array array) to sort the array by natural number, at which point 12 will be ranked after 2 $array 1 = $array 2 = Array ("Img12.png", "Img10.png", "Img2.png", "img1.png"); Sort ($array 1); echo "standard sort n"; Print_r ($array 1); Natsort ($array 2); echo "N natural sort N"; Print_r ($array 2); The code output is: Standard sort array ([0] = img1.png [1] = img10.png [2] = img12.png [3] = img2.png) Natural sort Array ([3] = = img1.png [2] = img2.png [1] = img10.png [0] = img12.png)
http://www.bkjia.com/PHPjc/531781.html www.bkjia.com true http://www.bkjia.com/PHPjc/531781.html techarticle describes several php4 useful array functions 1 void Extract (array var_array [, int extract_type] [, string prefix]]) to expand an associative array into the value of a variable name and variable, such as ... /c5>