Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to use PHP function array
How to use PHP function array
PHP array function is an integral part of PHP core. These functions can be used without installation.

Array ()

Create an array.

array_change_key_case()

Returns an array whose keys are uppercase or lowercase.

array_chunk()

Divide an array into new array blocks.

Array _ Column ()

Returns the value of a single column in the input array.

Array combination ()

Create a new array by merging two arrays (one for key names and one for key values).

Array count value ()

Used to calculate the number of occurrences of all values in an array.

array_diff()

Compares arrays and returns the difference set of two arrays (only compares key values).

Array _ Difference _ Association ()

Compares arrays and returns the difference set of two arrays (comparing key names and key values).

Array _ Difference _ Keyword ()

Compares arrays and returns the difference set of two arrays (only key names are compared).

array _ diff _ uassoc()

Compare arrays and return the difference set of two arrays (compare key names and key values, and use a custom key name comparison function).

Array _ Difference _ukey ()

Compare arrays and return the difference set of two arrays (only compare key names, and use the user-defined key name comparison function).

array_fill()

Populates an array with the given key values.

Array Fill Keyword ()

Populates an array with the key value of the given specified key name.

Array _ Filter ()

Filter elements in an array with a callback function.

array_flip()

Invert/swap key names and corresponding associated key values in the array.

array_intersect()

Compares arrays and returns the intersection of two arrays (only key values are compared).

array_intersect_assoc()

Compares arrays and returns the intersection of two arrays (comparing key names and key values).

Array _ Intersection _ Keyword ()

Compares arrays and returns the intersection of two arrays (only key names are compared).

array_intersect_uassoc()

Compares arrays and returns the intersection of two arrays (comparing key names and key values, using a custom key name comparison function).

array_intersect_ukey()

Compare arrays and return the intersection of two arrays (only compare key names, and use custom key name comparison function).

Array keyword exists ()

Checks whether the specified key name exists in the array.

Array keyword ()

Returns all key names in an array.

array_map()

Applies a user-defined function to each value of a given array and returns a new value.

array_merge()

Merge one or more arrays into one array.

Array _ merge _ recursive ()

Recursively merge one or more arrays into one array.

array_multisort()

Sort multiple arrays or multidimensional arrays.

array_pad()

Inserts a specified number of elements with a specified value into an array.

Array _ Pop ()

Delete the last element in the array (off the stack).

Array _ Product ()

Calculates the product of all values in an array.

array_push()

Inserts one or more elements at the end of an array (stack).

array_rand()

Randomly select one or more elements from an array and return the key name.

array_reduce()

By using user-defined functions, the array is iteratively reduced to a string and returned.

Array _ Replace ()

Replace all elements in the replaced array with the first array.

Array _ Substitution _ Recursion ()

Recursively replace all elements in the replaced array with the first array.

Array _ Invert ()

Inverts the elements in the original array, creates a new array and returns it.

Array search ()

Searches the array for a given value, and returns the corresponding key name if the search is successful.

array_shift()

Deletes the first element in the array and returns the value of the deleted element.

array_slice()

Returns the selected part of an array.

array_splice()

Removes the specified elements from the array and replaces them with other values.

array_sum()

Returns the sum of all the values in an array.

array_udiff()

Compares arrays and returns the difference set of two arrays (only compares key values and uses a user-defined key name comparison function).

array_udiff_assoc()

Compare arrays and return the difference set of two arrays (compare key names and key values, use built-in functions to compare key names and use custom functions to compare key values).

array_udiff_uassoc()

Compares arrays and returns the difference set of two arrays (comparing key names and key values and using two user-defined key name comparison functions).

array _ uintersect()

Compares arrays and returns the intersection of two arrays (only compares key values and uses a user-defined key name comparison function).

array_uintersect_assoc()

Compares arrays and returns the intersection of two arrays (compare key names and key values, compare key names with built-in functions, and compare key values with user-defined functions).

array_uintersect_uassoc()

Compares arrays and returns the intersection of two arrays (comparing key names and key values and using two user-defined key name comparison functions).

Array unique ()

Delete duplicate values in the array.

array_unshift()

Inserts one or more elements at the beginning of an array.

Array value ()

Returns all the values in an array.

array_walk()

Apply a user function to each member of the array.

Array _ walk _ recursive ()

Recursively applies the user function to each member of the array.

Sort ()

The key values sort the associative array in descending order.

asort()

The key values sort the associative array in ascending order.

Compact ()

Creates an array containing variable names and their values.

Count ()

Returns the number of elements in an array.

Current ()

Returns the current element in an array.

Every ()

Returns the current key/value pair in an array.

End ()

Point the internal pointer of the array to the last element.

Extract ()

Import the variables in the array into the current symbol table.

in_array()

Checks whether the specified value exists in the array.

Key ()

Gets the key name from the associative array.

krsort()

Sorts the associative array in descending order by key name.

ksort()

Sorts the associative array in ascending order of key names.

List ()

Assign the values in the array to some array variables.

natcasesort()

Use the "natural sort" algorithm to sort the array, regardless of case.

Natural sorting ()

Sort the array with "natural sorting" algorithm.

Next ()

Moves the internal pointer in the array forward one bit.

Location ()

Alias of the current ().

Previous Page ()

Inverts the internal pointer of an array to one bit.

Range ()

Creates an array containing the specified range of elements.

Reset ()

Point the internal pointer of the array to the first element.

rsort()

Sorts an array of values in descending order.

Play out of order ()

Rearrange the elements in the array in a random order.

sizeof()

Alias for count ().

Sort ()

Sorts an array of values in ascending order.

uasort()

Sorts the key values in an array using a user-defined comparison function.

uksort()

Sorts key names in an array using a user-defined comparison function.

usort()

Sorts an array using a user-defined comparison function.

Array (arglist)

Function: Create an array and assign values to it.

The arglist parameter is a comma-separated list of values that are assigned to the array elements contained in the variable. If this parameter is not specified, a zero-length array will be created.

Example: The general method of creating an array is as follows.

Dim AA(2)

AA(0)= 10

AA( 1)=20

AA(2)=30

MsgBox AA(2)

If it is as complicated as above, what about using array functions?

Dim AA

AA = array (10,20,30)

B=AA(2)

MsgBox B

In this case, the process is simpler. Just take it out when you use it.

Static object get (object array, int index)

Returns the value of the index part in the specified array object.

Static boolean getBoolean (object array, int index)

Returns the value of the index component in the specified array object as a boolean.

Static byte getByte (object array, int index)

Returns the value of the index component in the specified array object in bytes.

Static character getChar (object array, int index)

Returns the value of the index part in the specified array object as a character.

Static double getDouble (object array, int index)

Returns the value of the index component in the specified array object as a double.

Static floating-point getFloat (object array, int index)

Returns the value of the index component in the specified array object as a floating point.

Static int getInt (object array, int index)

Returns the value of the index component in the specified array object as an int.

Static int getLength (object array)

Returns the length of the specified array object as an integer.

Static long getLong (object array, int index)

Returns the value of the index part of the specified array object as a long.

Static short integer getShort (object array, int index)

Returns the value of the index part of the specified array object as a short integer.

Static object newInstance (class

Creates a new array with the specified component type and length.

Static object newInstance (class

Creates a new array with the specified component type and dimension.

Static empty collection (object array, int index, object value)

Sets the value of the index component in the specified array object to the specified new value.

Static void setBoolean (object array, int index, boolean z)

Sets the value of the index component in the specified array object to the specified Boolean value.

Static void setByte (object array, int index, byte b)

Array objects are used to store multiple values in a single variable.

parameter

The parameter size is the expected number of array elements. In the returned array, the length field will be set to the value of size.

Parameter elements ... elementn is a parameter list. When the constructor Array () is called with these parameters, the elements of the newly created array are initialized to these values. Its length field will also be set to the number of parameters.

Return value

Returns a newly created and initialized array.

If the constructor Array () is called with no parameters, the returned array is empty and the length field is 0.

When the constructor is called, only one numerical parameter is passed to it, and the constructor will return an array with the specified number and undefined elements.

When other parameters call Array (), the constructor initializes the array with the value specified by the parameter.

When the constructor is called as a function without using the new operator, its behavior is exactly the same as when it is called with the new operator.