1. What are the various ways to loop an array?
1) foreach (ability to loop associative and indexed arrays and objects)
2) for (loop indexed array only)
3) list and each mate use loop array
$arr = [‘a‘=>1,‘b‘=>2];while(list($key,$val) = each($arr)){echo $key$,val}
2.is_array(),is_bool,is_int(),is_integer(),is_numeric(),is_string(),is_object(),is_null,is_file,is_dir,is_readable,is_uploaded_file,is_writeable,
1) is_array () Check if a variable is an array
2) is_file () Check if it is a file
3) Is_dir () Check if it is a directory
4) is_uploaded_file () Check if it is post over HTTP
5) is_readable () check if readable
3. Count ()
1) Calculate the length of the array
4, Array_sum (), Array_product ()
1) array_sum () calculates an array's and
2) array_product () computes the product of an array
5, Array_count_values ()
1) calculates the number of occurrences of the value in the array and
6, In_array () array_key_exists () Array_search () key_exists ()
1) in_array (' xxx ', $arr) determines whether a character is in the array and returns false or True
2) array_key_exists (' xxx ', $arr) determine if a key exists in this array
3) array_search (' xxx ', $arr) determine if a value is in the array and return key
7, Array_values () Array_keys () Array_column ()
1) array_values ($arr) Returns the value of the array
2) Array_keys () returns all the keys of the array
2) Array_column ($arr, ' xxxx ') returns the value of one of the columns of the array
8, Array_filter () Array_walk () array_walk_recursive () Array_map ()
1) array_filter ($arr, ' function ') filters an array with a callback function
2) Array_walk ($arr, ' function ', [$param]) processes an array with a callback function and can be passed as a parameter to the function using a different value
3) array_walk_recursive ($arr, ' function ', [$param]) using functions for recursive use of an array
4) Array_map ($arr, Funciont) apply function to each element of the array
9, Array_unique ()
1) de-re-operation of the array
10, Array_change_key_case ()
1) Convert all key names in the array to lowercase
11. Range ()
1) Range (0,n,step= Step) to create an array
12, Array_fill () Array_fill_keys ()
1) Array_fill (key_start,long, ' xxx ') fills an array with a value
2) Array_fill_keys ($arr, ' xxx ') combines a value with the current array to produce a new array with $arr as the key and a value of XXX
13, Array_flip () Array_reverse ()
1) Array_flip () The build and value of the Exchange array
2) Array_reverse ($arr, [true]) reverses the array if the second argument is true to preserve the original key of the array
14, Array_pad ()
1) array_pad ($arr, long,xxx) fills the array to the specified length
15, Array_rand () Shuffle ()
1) Array_rand ($arr, 2) randomly remove several arrays
2) Shuffle () scrambled array
Application scenario: Random or a value of an array
16, Array_shift () Array_unshift () Array_push () Array_pop ()
1) array_shift ($arr) POPs a value from the head, stack
2) Array_unshift ($arr, [a,b,c ...]) into the stack
Application Scenario: Simulation stack
3) Array_push ($arr, [a,b,c ...]) inserts a value into the array from the tail
4) Array_pop ($arr) POPs a value from the tail
Scenario: cooperating with Array_unshift to simulate a queue
18, Array_merge () array_merge_recursive ()
1) Array_merge () merges two arrays, which overwrite the same values as the former keys
2) array_merge_recursive () recursively merges two arrays, which overwrite the same values as the former keys
Scenario: Merging of two profiles within a framework
19, Array_multisort (), sort (), Rsort (), Krsort (), Ksort (), Asort (), Arsort ()
1) array_multisort ($arr [0],sort_asc, $arr [1],sort_desc];
To sort multiple arrays
2) Sort Array Ascending
3) Rsort Array Descending
4) Krsort using key values for array descending
5) Ksort use key values to ascending the array
6) Asort the array to sort ascending and keep the index relationship
7) Arsort the array in descending order and keep the index relationship
20. Next Prev Rest End current
1) Next//move the pointer in the array forward one
2) prev//reverse array internal pointer back to a
3) rest//Point the array pointer to the first cell
4) End//To point the array pointer to the last cell
5) Current//returns the cell in the array
21, Max () min ()
1) Max () takes maximum value
2) min () Minimum value
You should be in this position. Learn PHP (2)