There are many PHP functions that need to be queried by the API.
Copy CodeThe code is as follows:
/*
#数组 No Limit size: $arr [0]=1; $arr [1]=2; $arr =array ("0", "1"), $list ($num 1, $num 2) = $arr;
Array range (int low,int high[,int Step])
Low minimum number, high maximum, step step
int Array_unshift (array array,mixed vari) array before inserting
Array_push Array Footer Additions
Array_shift Array Header Delete
Array_pop Array Trailing Delete
#定位数组
Boolean In_array (mixed Needle,array Haystack,[,boolean Strict])
Boolean array_key_exists (mixed Key,array array) search key
Array_search () searching associative array values
Array_keys () returns an array that contains all the keys that are searched
Array_values () returns all the values of the array.
#遍历数组
Mixed key (array array)
Current (array array) gets the value
Array each (array array) returns the current key, value pair
Next (array array) points to the next
Prev (array array) moves to the previous
Reset (array array) moves to the first
End (array array) moves to the last
#向函数传递数组值
Boolean array_walk (array &array,callback function,[,mixed UserData])
#确定数组的大小及唯一性
Integer count (array array[,int mode]) similar to sizeof ()
Array array_count_values (array array) group statistics the number of occurrences of each value
Array_unique () Remove duplicate values and remain unique
#排序
Array_reverse () Sequential reverse
Array_flip () Swap keys and values
void sort (array array[,int sort_flags])
Sort_flgs{[sort_numberic numerical sort],[sort_regular by ASCII],[sort_string]}
Asort () Ascending
Rsort () reverse order
Arsort () reverse order
Natsort () Natural sort
Natcasesort () case-insensitive natural sorting
Ksort () key-value ordering
Krsort () Ordering of key values in reverse order
void Usort (array array,callback function name) user-defined sort
#合并, splitting, combining, decomposing arrays
Array_merge_recursive () Merge
Array_merge_combine () Append
Array_merge () Connect to the new array
Array_slice (array array,int offse[,int length]) split
Array_intersect (), ARRAY_INTERSECT_ASSOC () array intersection
Array_diff (), ARRAY_DIFF_ASSOC () difference set
Array_rand (), Shuffle () random array
Array_sum () sum
Array_chunk into multidimensional arrays
*/
Creates an even array of 0-20, and 2 is the step size
$even =range (0,20,2);
Print array
Print_r ($even);
Determines whether an array
printf ("This number was an array:%s
", (Is_array ($even)?" True ":" false "));
echo "
";
Adds a subkey to the head of the array and prints
Array_unshift ($even, 522,54);
Print_r ($even);
A variable is defined and then searched in the array, and the variable is found when it is present.
$sa = 522;
if (In_array ($sa, $even)) {
echo "Find it $sa";
};
echo "
";
Searching for array key keys
if (Array_key_exists (4, $even)) {
Echo $even [4]. "Exists.";
}
echo "
";
Print_r (Array_values ($even));
Traversing a printed array
while ($key =key ($even)) {
echo "
". $key;
Next ($even);
}
Statistic array Size
echo "
";
echo count ($even);
Sort
echo "
";
Sort ($even);
Print_r ($even);
?>
http://www.bkjia.com/PHPjc/322285.html www.bkjia.com true http://www.bkjia.com/PHPjc/322285.html techarticle there are many PHP functions that need to be queried by the API. Copy the code as follows:? PHP/* #数组 No Limit size: $arr [0]=1; $arr [1]=2; $arr =array ("0", "1"), $list ($num 1, $num 2) = $arr; Array ra ...