In PHP, use list to extract the values in the array, such as list ($ a, $ B) $ array.
1. value extraction
In PHP, use list to extract the values in the array, such as list ($ a, $ B) = $ array. If the number of values in the list is greater than the number of arrays, the excess values in the list are set to NULL. You can also use commas to skip the values in the array, such as list ($ a, $ B) = $ array.
2. divide arrays
To obtain the sub-array, use array_slice (array, offset, length. It returns a new subscript array starting from 0. If the subscript of the original array is a string, it seems meaningless. it is best not to use it. you can use array_splice to obtain the substring.
3. Divide the array into multiple arrays
Array_chunk can be used to divide an array into two-dimensional arrays. For details, refer to the official instructions at the link.
4. keys and values
Array_keys ($ array) to obtain an array composed of array indexes
Array_value ($ array) is used to obtain an array consisting of array values. The index is reassigned from 0.
Array_key_exists ($ key, array). check whether the element exists.
Array_splice: delete the inserted element.
5. conversion between arrays and variables
Extract (array) converts an array to a variable.
Compact () converts a variable to an array