• The starting subscript of an array may not be from 0 Start , The example is from 2 Start .

    $data = array(2=>'A','B','C');     Running results :$data = array(2=>'A',3=>'B',4=>'C');


  • unset()   Delete the entire array      Delete a single array element

Initial array :$data = array('name'=> ' Koreyoshi ','age'=> 24,'sex'=> ' Woman ');

unset($data);                     Running results :NULL

unset($data['name']);        Running results :$data = array('age'=>24,'sex'=>' Woman ');


  • list()     Assign values in an array to variables

$data = array(' Koreyoshi ',' Woman ','24');

list($a,$b,$c) = $data;              Running results :$a=' Koreyoshi '; $b=' Woman '; $c='24';

notes : This function is only used for arrays of numeric indexes , And assume that the digital index starts from 0 Start .


  • range()     Automatically generate a data containing a specified range cell

$data = range(0,5);         Running results :$data = array(0,1,2,3,4,5);


  • array_count_values(array) Used to count the number of occurrences of all values in the array .    Count the number of the same elements in the array

$data = array('name'=> ' Koreyoshi ','age'=> 24,'sex'=> ' Woman ','nickname'=>' Koreyoshi ');

array_count_values($data);             Running results :array(' Koreyoshi '=>2,'24'=>1,' Woman '=>1);


  • array_change_key_case(array,case)   Change all keys in the array to lowercase or uppercase .      Case all the keys in the array

array It's necessary . Specify the array to use .

case         Optional . Possible value :CASE_LOWER - The default value is . Convert the keys of the array to lowercase letters .CASE_UPPER - Convert the keys of the array to uppercase letters .

$data = array('Name'=> ' Koreyoshi ','Age'=> 24,'Sex'=> ' Woman ');

array_change_key_case($data,CASE_UPPER);

Running results :$data = array('NAME'=> ' Koreyoshi ','AGE'=> 24,'SEX'=> ' Woman ');

array_change_key_case($data,CASE_LOWER);

Running results :$data = array('name'=> ' Koreyoshi ','age'=> 24,'sex'=> ' Woman ');


  • array_chunk(array,size,preserve_key)     Divide an array into new array blocks .     Split the array into new array blocks

array: It's necessary , Array ;

size: It's necessary , Specifies how many elements each new array contains

preserve_key: Optional ,true - Keep the key names in the original array .false - Default . Each result array uses a new zero based array index

$data = array('Name'=> ' Koreyoshi ','Age'=> 24,'Sex'=> ' Woman ');

array_chunk($data,2);

Running results :$data = array(0=>array(0=>' Koreyoshi ',1=>24),1=>array(0=>' Woman '));


  • array_column(array,column_key,index_key)     Returns the value of a single column in the input array

  • array: It's necessary , Array ;

column_key: It's necessary , Columns that need to return values . The parameter can also be NULL, This returns the entire array

index_key: Optional , A column used as an index or key to return an array .

$data = array(    array('id'=>1,'name'=>' Koreyoshi '),    array('id'=>2,'name'=>' Luoqiu '),    array('id'=>2,'name'=>' Lomo '),);

array_column($data,'name');         Running results :$data = array(0=>' Koreyoshi ',1=>' Luoqiu ',2=>' Lomo ');


  • array_combine(keys,values)    Create a new array by merging two arrays , One of the array elements is the key name , The other array element is the key value

keys: It's necessary , Array of key names ;        values: It's necessary , Array of key values ;

$fname=array("Bill","Steve","Mark");    $age=array("60","56","31");

array_combine($fname,$age);         Running results :array('Bill'=>60,'Steve'=>56,'Mark'=>31);

notes : The number of elements in the key name array and the key value array must be the same ! If one of the arrays is empty , Or the number of elements of two arrays is different , Then the function returns false.


  • Fill the array

array_fill(index,number,value)   Fill the array with the given key value .         Fill the array with key values

index: It's necessary , The first index of the returned array ;

number: It's necessary , Specify the number of elements to insert ;

value: It's necessary , Specifies the values used to fill the array ;

array_fill(3,4,blue);         Running results :array("3"=>"blue","4"=>"blue","5"=>"blue","6"=>"blue");

array_fill_keys(keys,value)   Fills the array with the given key value of the specified key name .    Fills an array with the specified keys and values

keys: It's necessary , Use the value of the array as the key . Illegal values will be converted to strings ;

value: It's necessary , The values used to fill the array ;

$keys = array("a","b","c","d");    array_fill_keys($keys,"blue);      Running results :array("a"=>"blue","b"=>"blue","c"=>"blue","d"=>"blue");


  • array_filter(array,callbackfunction)   Use the callback function to filter the elements in the array

array It's necessary . Specify the array to filter .

callbackfunction It's necessary . Specifies the callback function to use .

This function passes each key value in the input array to the callback function . If the callback function returns true, Return the current key value in the input array to the result array . Array key names remain the same .

function test_odd($var){    return($var & 1);    }

$a1=array("a","b",2,3,4);        array_filter($a1,"test_odd");         Running results :array("3"=>"3");


  • array_flip(array)     Swap keys and values in an array .     Inverts all the keys in the array and their associated values

$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");    array_flip($a1);     Running results :array("red"=>"a","green"=>"b","blue"=>"c","yellow"=>"d");


  • array_key_exists(key,array)    Check if the specified key name exists in the array .    Check whether the specified key name exists in an array , If the key name exists, return true, Returns if the key name does not exist false

key It's necessary . Specify the key name .        array It's necessary . Specify an array .


  • array_keys(array,value,strict)   Returns all key names in the array .  Returns a new array containing all the key names in the array

array It's necessary . Specify an array .

value Optional . You can specify key values , Then only the key name corresponding to the key value will be returned .

strict          Optional . And value Parameters used together . Possible value :true - Returns the key name with the specified key value . Dependency type , Numbers 5 And string "5" Is different .    false - The default value is . Type independent , Numbers 5 And string "5" It's the same .

$a=array("Volvo"=>"XC90","BMW"=>"X5","Toyota"=>"Highlander");

array_keys($a);         Running results :array("0"=>"Volvo","1"=>"BMW","2"=>"Toyota");

array_keys($a,"Highlander");          Running results :array("0"=>"Toyota");

$a=array(10,20,30,"10");

array_keys($a,"10",false);      Running results :array("0"=>0,"1"=>3);

array_keys($a,"10",true);      Running results :array("0"=>3);


  • array_map(myfunction,array1,array2,array3...)    Send each value in the array to a user-defined function , Return the new value .  Apply a user-defined function to each value in the array , And return the array with new value after the user-defined function .

myfunction It's necessary . The name of the user-defined function , Or is it null.

array1 It's necessary . Specify an array .          array2 Optional . Specify an array .        array3 Optional . Specify an array .

Assign the function name to null when :

$a1=array("Dog","Cat");$a2=array("Puppy","Kitten");array_map(null,$a1,$a2);

Running results :Array ( [0] => Array ( [0] => Dog [1] => Puppy ) [1] => Array ( [0] => Cat [1] => Kitten ) );


  • array_multisort(array1,sorting order,sorting type,array2,array3...)      Sort multiple arrays or multidimensional arrays .        Return sort array , You can enter one or more arrays . Function to sort the first array , Then there are other arrays , If two or more values are the same , It will sort the next array .

sorting order     Optional . Set the order . Possible value :    SORT_ASC - Default . In ascending order (A-Z).    SORT_DESC - Sort in descending order (Z-A).

sorting type     Optional . Specify sort type . Possible value :

SORT_REGULAR - Default . Put each item in the regular order (Standard ASCII, Don't change the type ).

SORT_NUMERIC - Treat each item as a number .

SORT_STRING - Treat each item as a string .

SORT_LOCALE_STRING - Treat each item as a string , Based on the current locale ( It can be done by setlocale() Make changes ).

SORT_NATURAL - Treat each item as a string , Use similar natsort() Natural ordering .

SORT_FLAG_CASE - Can combine ( Press bit or )SORT_STRING or SORT_NATURAL Sort strings , Case insensitive .

notes : String key names will be reserved , But the number key names will be re indexed , from 0 Start , And 1 Increasing .

You can set the sort order and sort type parameters after each array . If not set , Each array parameter will use the default value .

The array in the parameter is treated as a column of a table and sorted in rows - This is similar SQL Of ORDER BY The function of clause . The first array is the main array to sort . Rows in an array ( value ) If it's the same , Will be sorted according to the size of the corresponding value in the next input array , And so on .


array_values(array)     Returns all the values in the array .

count(array,mode)     Returns the number of elements in the array .

sizeof(array,mode)     count() Another name for .

compact(var1,var2...)     Create an array of variable names and their values .

extract(array,extract_rules,prefix)     Import variables from an array into the current symbol table .

in_array(search,array,type)     Check whether the specified value exists in the array .

key(array)     Get the key name from the associated array .

range(low,high,step)      Create an array containing the specified range cells .

shuffle(array)     Scramble the array .     This function assigns new key names to the elements in the array . Existing key names will be deleted

array_pad(array,size,value)      Fill the array with a value to the specified length .         If you will size The parameter is set to a negative number , This function inserts new elements before the original array .

array_pop(array)      Delete the last element of the array ( Out of the stack ).

array_push(array,value1,value2...) Insert one or more elements at the end of the array ( Push ).

array_shift(array)      Delete the first element in the array , And return the value of the deleted element .     If the key name is numeric , All elements get new key names , from 0 Start , And 1 Increasing

array_unshift(array,value1,value2,value3...)     Insert one or more elements at the beginning of the array .     This function returns the number of elements in the array .

array_product(array)         Calculate the product of all the values in the array .

array_sum(array)     Returns the sum of the values in the array .

array_rand(array,number)         Returns one or more random key names in an array .

array_reduce(array,myfunction,initial)     By using user-defined functions , Returns an array as a string .

array_replace(array1,array2,array3...)     Replace the value of the first array with the value of the following array .

array_replace_recursive(array1,array2,array3...)      Recursively replace the value of the first array with the value of the next array .

array_merge(array1,array2,array3...)     Combine one or more arrays into an array .

array_merge_recursive(array1,array2,array3...)     Recursively merge one or more arrays .

array_reverse(array,preserve)         Return the array in reverse order . For integer key names , If the second parameter is specified as true, The key name of the element remains unchanged , Otherwise the key name will be lost .

array_search(value,array,strict)         Search the value given in the array and return the key name .

array_slice(array,start,length,preserve)     Returns the selected part of the array .

array_splice(array,start,length,array)     Delete and replace the elements specified in the array .

array_unique(array)     Delete duplicate values in the array .     When the values of several array elements are equal , Keep only the first element , Other elements are removed .

array_walk(array,myfunction,userdata...)     Apply user functions... To each member of the array .

array_walk_recursive(array,myfunction,parameter...)     Recursively apply user functions... To each member of the array .


  • Sort

arsort(array,sortingtype)     Sort the associated array in descending order according to the key value .

asort(array,sortingtype)     Sort the associated array in ascending order according to the key value .

krsort(array,sortingtype)    Reverse the array by key name .

ksort(array,sortingtype)     Sort arrays by key names .

natcasesort(array)     use “ Natural ordering ” The algorithm sorts the array case insensitive .

natsort(array)     use “ Natural ordering ” The algorithm sorts the array .

rsort(array,sortingtype)     Sort the array in reverse .

sort(array,sortingtype)     Sort the array .

uasort(array,myfunction)    Use the user-defined comparison function to sort the key values in the array .

uksort(array,myfunction)      Use the user-defined comparison function to sort the key names in the array .

usort(array,myfunction)     Use the user-defined comparison function to sort the array .


  • The movement of the array pointer

current(array)     Returns the current element in the array .

each(array)     Returns the current key in the array / It's worth it .

end(array)     Point the internal pointer of the array to the last element .

prev(array)     Returns the internal pointer of an array to one bit .

next(array)     Move the internal pointer in the array one bit forward .

reset(array)     Point the array's internal pointer to the first element .

pos(array)    current() Another name for .

notes :  If the array contains empty cells , Or the value of the cell is 0 The function also returns FALSE.

To traverse correctly, you may have empty cells or cell values of 0 Array of , Please see the each() function .

notes :each() Function returns the key name and value of the current element , And move the internal pointer forward .

The key name and value of the element are returned to an array with four elements . Two elements (1 and Value) Contains key values , Two elements (0 and Key) Contains the key name .

If the internal pointer goes beyond the range of the array , This function will return FALSE.


  • Compare arrays , Return difference set

    array_diff(array1,array2,array3...)      Compare arrays , Return difference set ( Just compare key values ).

    array_diff_assoc(array1,array2,array3...)   Compare arrays , Return difference set ( Compare key names with key values ).

    array_diff_key(array1,array2,array3...)      Compare arrays , Return difference set ( Just compare key names ).

    array_diff_uassoc(array1,array2,array3...,myfunction)      Compare arrays , Return difference set ( Compare key names with key values , Use the user-defined key name comparison function ).

array_udiff(array1,array2,array3...,myfunction)         Compare arrays , Return difference set ( It's only worth , Use a user-defined key name comparison function ).

array_diff_ukey(array1,array2,array3…,myfunction)     Compare arrays , Return difference set ( Just compare key names , Use the user-defined key name comparison function ).

array_udiff_assoc(array1,array2,array3...,myfunction)     Compare arrays , Return difference set ( Compare keys and values , Use built-in functions to compare key names , Use user-defined functions to compare key values ).

array_udiff_uassoc(array1,array2,array3...,myfunction_key,myfunction_value)         Compare arrays , Return difference set ( Compare keys and values , Use two user-defined key name comparison functions ).

    • Compare arrays , Return to intersection

      array_intersect(array1,array2,array3...)      Compare arrays , Return to intersection ( Just compare key values ).

      array_intersect_assoc(array1,array2,array3...)       Compare arrays , Return to intersection ( Compare key names with key values ).

      array_intersect_key(array1,array2,array3...)       Compare arrays , Return to intersection ( Just compare key names ).

      array_intersect_uassoc(array1,array2,array3...,myfunction)       Compare arrays , Return to intersection ( Compare key names with key values , Use the user-defined key name comparison function ).

array_intersect_ukey(array1,array2,array3...,myfunction)   Compare arrays , Return to intersection ( Just compare key names , Use the user-defined key name comparison function ).

array_uintersect(array1,array2,array3...,myfunction)     Compare arrays , Return to intersection ( It's only worth , Use a user-defined key name comparison function ).

array_uintersect_assoc(array1,array2,array3...,myfunction) Compare arrays , Return to intersection ( Compare keys and values , Use built-in functions to compare key names , Use user-defined functions to compare key values ).

array_uintersect_uassoc(array1,array2,array3...,myfunction_key,myfunction_value) Compare arrays , Return to intersection ( Compare keys and values , Use two user-defined key name comparison functions ).

  • The starting subscript of an array may not be from 0 Start , The example is from 2 Start .

    $data = array(2=>'A','B','C');     Running results :$data = array(2=>'A',3=>'B',4=>'C');


  • unset()   Delete the entire array      Delete a single array element

Initial array :$data = array('name'=> ' Koreyoshi ','age'=> 24,'sex'=> ' Woman ');

unset($data);                     Running results :NULL

unset($data['name']);        Running results :$data = array('age'=>24,'sex'=>' Woman ');


  • list()     Assign values in an array to variables

$data = array(' Koreyoshi ',' Woman ','24');

list($a,$b,$c) = $data;              Running results :$a=' Koreyoshi '; $b=' Woman '; $c='24';

notes : This function is only used for arrays of numeric indexes , And assume that the digital index starts from 0 Start .


  • range()     Automatically generate a data containing a specified range cell

$data = range(0,5);         Running results :$data = array(0,1,2,3,4,5);


  • array_count_values(array) Used to count the number of occurrences of all values in the array .    Count the number of the same elements in the array

$data = array('name'=> ' Koreyoshi ','age'=> 24,'sex'=> ' Woman ','nickname'=>' Koreyoshi ');

array_count_values($data);             Running results :array(' Koreyoshi '=>2,'24'=>1,' Woman '=>1);


  • array_change_key_case(array,case)   Change all keys in the array to lowercase or uppercase .      Case all the keys in the array

array It's necessary . Specify the array to use .

case         Optional . Possible value :CASE_LOWER - The default value is . Convert the keys of the array to lowercase letters .CASE_UPPER - Convert the keys of the array to uppercase letters .

$data = array('Name'=> ' Koreyoshi ','Age'=> 24,'Sex'=> ' Woman ');

array_change_key_case($data,CASE_UPPER);

Running results :$data = array('NAME'=> ' Koreyoshi ','AGE'=> 24,'SEX'=> ' Woman ');

array_change_key_case($data,CASE_LOWER);

Running results :$data = array('name'=> ' Koreyoshi ','age'=> 24,'sex'=> ' Woman ');


  • array_chunk(array,size,preserve_key)     Divide an array into new array blocks .     Split the array into new array blocks

array: It's necessary , Array ;

size: It's necessary , Specifies how many elements each new array contains

preserve_key: Optional ,true - Keep the key names in the original array .false - Default . Each result array uses a new zero based array index

$data = array('Name'=> ' Koreyoshi ','Age'=> 24,'Sex'=> ' Woman ');

array_chunk($data,2);

Running results :$data = array(0=>array(0=>' Koreyoshi ',1=>24),1=>array(0=>' Woman '));


    • array_column(array,column_key,index_key)     Returns the value of a single column in the input array

array: It's necessary , Array ;

column_key: It's necessary , Columns that need to return values . The parameter can also be NULL, This returns the entire array

index_key: Optional , A column used as an index or key to return an array .

$data = array(    array('id'=>1,'name'=>' Koreyoshi '),    array('id'=>2,'name'=>' Luoqiu '),    array('id'=>2,'name'=>' Lomo '),);

array_column($data,'name');         Running results :$data = array(0=>' Koreyoshi ',1=>' Luoqiu ',2=>' Lomo ');


  • array_combine(keys,values)    Create a new array by merging two arrays , One of the array elements is the key name , The other array element is the key value

keys: It's necessary , Array of key names ;        values: It's necessary , Array of key values ;

$fname=array("Bill","Steve","Mark");    $age=array("60","56","31");

array_combine($fname,$age);         Running results :array('Bill'=>60,'Steve'=>56,'Mark'=>31);

notes : The number of elements in the key name array and the key value array must be the same ! If one of the arrays is empty , Or the number of elements of two arrays is different , Then the function returns false.


  • Fill the array

array_fill(index,number,value)   Fill the array with the given key value .         Fill the array with key values

index: It's necessary , The first index of the returned array ;

number: It's necessary , Specify the number of elements to insert ;

value: It's necessary , Specifies the values used to fill the array ;

array_fill(3,4,blue);         Running results :array("3"=>"blue","4"=>"blue","5"=>"blue","6"=>"blue");

array_fill_keys(keys,value)   Fills the array with the given key value of the specified key name .    Fills an array with the specified keys and values

keys: It's necessary , Use the value of the array as the key . Illegal values will be converted to strings ;

value: It's necessary , The values used to fill the array ;

$keys = array("a","b","c","d");    array_fill_keys($keys,"blue);      Running results :array("a"=>"blue","b"=>"blue","c"=>"blue","d"=>"blue");


  • array_filter(array,callbackfunction)   Use the callback function to filter the elements in the array

array It's necessary . Specify the array to filter .

callbackfunction It's necessary . Specifies the callback function to use .

This function passes each key value in the input array to the callback function . If the callback function returns true, Return the current key value in the input array to the result array . Array key names remain the same .

function test_odd($var){    return($var & 1);    }

$a1=array("a","b",2,3,4);        array_filter($a1,"test_odd");         Running results :array("3"=>"3");


  • array_flip(array)     Swap keys and values in an array .     Inverts all the keys in the array and their associated values

$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");    array_flip($a1);     Running results :array("red"=>"a","green"=>"b","blue"=>"c","yellow"=>"d");


  • array_key_exists(key,array)    Check if the specified key name exists in the array .    Check whether the specified key name exists in an array , If the key name exists, return true, Returns if the key name does not exist false

key It's necessary . Specify the key name .        array It's necessary . Specify an array .


  • array_keys(array,value,strict)   Returns all key names in the array .  Returns a new array containing all the key names in the array

array It's necessary . Specify an array .

value Optional . You can specify key values , Then only the key name corresponding to the key value will be returned .

strict          Optional . And value Parameters used together . Possible value :true - Returns the key name with the specified key value . Dependency type , Numbers 5 And string "5" Is different .    false - The default value is . Type independent , Numbers 5 And string "5" It's the same .

$a=array("Volvo"=>"XC90","BMW"=>"X5","Toyota"=>"Highlander");

array_keys($a);         Running results :array("0"=>"Volvo","1"=>"BMW","2"=>"Toyota");

array_keys($a,"Highlander");          Running results :array("0"=>"Toyota");

$a=array(10,20,30,"10");

array_keys($a,"10",false);      Running results :array("0"=>0,"1"=>3);

array_keys($a,"10",true);      Running results :array("0"=>3);


  • array_map(myfunction,array1,array2,array3...)    Send each value in the array to a user-defined function , Return the new value .  Apply a user-defined function to each value in the array , And return the array with new value after the user-defined function .

myfunction It's necessary . The name of the user-defined function , Or is it null.

array1 It's necessary . Specify an array .          array2 Optional . Specify an array .        array3 Optional . Specify an array .

Assign the function name to null when :

$a1=array("Dog","Cat");$a2=array("Puppy","Kitten");array_map(null,$a1,$a2);

Running results :Array ( [0] => Array ( [0] => Dog [1] => Puppy ) [1] => Array ( [0] => Cat [1] => Kitten ) );


  • array_multisort(array1,sorting order,sorting type,array2,array3...)      Sort multiple arrays or multidimensional arrays .        Return sort array , You can enter one or more arrays . Function to sort the first array , Then there are other arrays , If two or more values are the same , It will sort the next array .

sorting order     Optional . Set the order . Possible value :    SORT_ASC - Default . In ascending order (A-Z).    SORT_DESC - Sort in descending order (Z-A).

sorting type     Optional . Specify sort type . Possible value :

SORT_REGULAR - Default . Put each item in the regular order (Standard ASCII, Don't change the type ).

SORT_NUMERIC - Treat each item as a number .

SORT_STRING - Treat each item as a string .

SORT_LOCALE_STRING - Treat each item as a string , Based on the current locale ( It can be done by setlocale() Make changes ).

SORT_NATURAL - Treat each item as a string , Use similar natsort() Natural ordering .

SORT_FLAG_CASE - Can combine ( Press bit or )SORT_STRING or SORT_NATURAL Sort strings , Case insensitive .

notes : String key names will be reserved , But the number key names will be re indexed , from 0 Start , And 1 Increasing .

You can set the sort order and sort type parameters after each array . If not set , Each array parameter will use the default value .

The array in the parameter is treated as a column of a table and sorted in rows - This is similar SQL Of ORDER BY The function of clause . The first array is the main array to sort . Rows in an array ( value ) If it's the same , Will be sorted according to the size of the corresponding value in the next input array , And so on .


array_values(array)     Returns all the values in the array .

count(array,mode)     Returns the number of elements in the array .

sizeof(array,mode)     count() Another name for .

compact(var1,var2...)     Create an array of variable names and their values .

extract(array,extract_rules,prefix)     Import variables from an array into the current symbol table .

in_array(search,array,type)     Check whether the specified value exists in the array .

key(array)     Get the key name from the associated array .

range(low,high,step)      Create an array containing the specified range cells .

shuffle(array)     Scramble the array .     This function assigns new key names to the elements in the array . Existing key names will be deleted

array_pad(array,size,value)      Fill the array with a value to the specified length .         If you will size The parameter is set to a negative number , This function inserts new elements before the original array .

array_pop(array)      Delete the last element of the array ( Out of the stack ).

array_push(array,value1,value2...) Insert one or more elements at the end of the array ( Push ).

array_shift(array)      Delete the first element in the array , And return the value of the deleted element .     If the key name is numeric , All elements get new key names , from 0 Start , And 1 Increasing

array_unshift(array,value1,value2,value3...)     Insert one or more elements at the beginning of the array .     This function returns the number of elements in the array .

array_product(array)         Calculate the product of all the values in the array .

array_sum(array)     Returns the sum of the values in the array .

array_rand(array,number)         Returns one or more random key names in an array .

array_reduce(array,myfunction,initial)     By using user-defined functions , Returns an array as a string .

array_replace(array1,array2,array3...)     Replace the value of the first array with the value of the following array .

array_replace_recursive(array1,array2,array3...)      Recursively replace the value of the first array with the value of the next array .

array_merge(array1,array2,array3...)     Combine one or more arrays into an array .

array_merge_recursive(array1,array2,array3...)     Recursively merge one or more arrays .

array_reverse(array,preserve)         Return the array in reverse order . For integer key names , If the second parameter is specified as true, The key name of the element remains unchanged , Otherwise the key name will be lost .

array_search(value,array,strict)         Search the value given in the array and return the key name .

array_slice(array,start,length,preserve)     Returns the selected part of the array .

array_splice(array,start,length,array)     Delete and replace the elements specified in the array .

array_unique(array)     Delete duplicate values in the array .     When the values of several array elements are equal , Keep only the first element , Other elements are removed .

array_walk(array,myfunction,userdata...)     Apply user functions... To each member of the array .

array_walk_recursive(array,myfunction,parameter...)     Recursively apply user functions... To each member of the array .

  • Sort

arsort(array,sortingtype)     Sort the associated array in descending order according to the key value .

asort(array,sortingtype)     Sort the associated array in ascending order according to the key value .

krsort(array,sortingtype)    Reverse the array by key name .

ksort(array,sortingtype)     Sort arrays by key names .

natcasesort(array)     use “ Natural ordering ” The algorithm sorts the array case insensitive .

natsort(array)     use “ Natural ordering ” The algorithm sorts the array .

rsort(array,sortingtype)     Sort the array in reverse .

sort(array,sortingtype)     Sort the array .

uasort(array,myfunction)    Use the user-defined comparison function to sort the key values in the array .

uksort(array,myfunction)      Use the user-defined comparison function to sort the key names in the array .

usort(array,myfunction)     Use the user-defined comparison function to sort the array .

  • The movement of the array pointer

current(array)     Returns the current element in the array .

each(array)     Returns the current key in the array / It's worth it .

end(array)     Point the internal pointer of the array to the last element .

prev(array)     Returns the internal pointer of an array to one bit .

next(array)     Move the internal pointer in the array one bit forward .

reset(array)     Point the array's internal pointer to the first element .

pos(array)    current() Another name for .

notes :  If the array contains empty cells , Or the value of the cell is 0 The function also returns FALSE.

To traverse correctly, you may have empty cells or cell values of 0 Array of , Please see the each() function .

notes :each() Function returns the key name and value of the current element , And move the internal pointer forward .

The key name and value of the element are returned to an array with four elements . Two elements (1 and Value) Contains key values , Two elements (0 and Key) Contains the key name .

If the internal pointer goes beyond the range of the array , This function will return FALSE.

    • Compare arrays , Return difference set

      array_diff(array1,array2,array3...)      Compare arrays , Return difference set ( Just compare key values ).

      array_diff_assoc(array1,array2,array3...)   Compare arrays , Return difference set ( Compare key names with key values ).

      array_diff_key(array1,array2,array3...)      Compare arrays , Return difference set ( Just compare key names ).

      array_diff_uassoc(array1,array2,array3...,myfunction)      Compare arrays , Return difference set ( Compare key names with key values , Use the user-defined key name comparison function ).

array_diff_ukey(array1,array2,array3...,myfunction)

Compare arrays , Return difference set ( Just compare key names , Use the user-defined key name comparison function ).

array_udiff(array1,array2,array3...,myfunction)         Compare arrays , Return difference set ( It's only worth , Use a user-defined key name comparison function ).

array_udiff_assoc(array1,array2,array3...,myfunction)     Compare arrays , Return difference set ( Compare keys and values , Use built-in functions to compare key names , Use user-defined functions to compare key values ).

array_udiff_uassoc(array1,array2,array3...,myfunction_key,myfunction_value)         Compare arrays , Return difference set ( Compare keys and values , Use two user-defined key name comparison functions ).

    • Compare arrays , Return to intersection

      array_intersect(array1,array2,array3...)      Compare arrays , Return to intersection ( Just compare key values ).

      array_intersect_assoc(array1,array2,array3...)       Compare arrays , Return to intersection ( Compare key names with key values ).

      array_intersect_key(array1,array2,array3...)       Compare arrays , Return to intersection ( Just compare key names ).

      array_intersect_uassoc(array1,array2,array3...,myfunction)       Compare arrays , Return to intersection ( Compare key names with key values , Use the user-defined key name comparison function ).

array_intersect_ukey(array1,array2,array3...,myfunction)

Compare arrays , Return to intersection ( Just compare key names , Use the user-defined key name comparison function ).

array_uintersect(array1,array2,array3...,myfunction)     Compare arrays , Return to intersection ( It's only worth , Use a user-defined key name comparison function ).

array_uintersect_assoc(array1,array2,array3...,myfunction) Compare arrays , Return to intersection ( Compare keys and values , Use built-in functions to compare key names , Use user-defined functions to compare key values ).

array_uintersect_uassoc(array1,array2,array3...,myfunction_key,myfunction_value) Compare arrays , Return to intersection ( Compare keys and values , Use two user-defined key name comparison functions ).

【 WeChat development 】 Get along well with PHP Array usage ! More articles about

  1. C# WeChat development - WeChat JS-SDK(1) It was passed config Interface injection authority validation configuration

    The official document is wechat JS-SDK How to use http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#JSSDK.E4.BD.B ...

  2. java WeChat development API First step Server access

    I How to access the server , Let's introduce it to you One . explain * This example is based on wechat development document :http://mp.weixin.qq.com/wiki/home/index.html The latest version (4/3/2016 5:34 ...

  3. Use Html5+C#+ WeChat Develop mobile terminal game detailed tutorial :( One ) order ( About the author's failure in starting a business )

    Speaking of dreams , I remember it clearly 2012 year 7 I graduated at the beginning of this month , The day I got my diploma, I bought the green ticket to Shenzhen the next day ,500 Multiple blocks ,26 Hour drive . The next day, I took my luggage to Shenzhen . At the beginning, I just wanted to see the world in the past , Learn something new ...

  4. Lethal thunder dog --- WeChat development 55---- WeChat js-sdk Interface development (2) Signature algorithm of interface function introduction

    We JS-SDK There are actually many interfaces in it startRecord--- sound recording stopRecord--- Stop the recording playVoice--- Play pauseVoice--- Pause play uploadImage-- ...

  5. C# Realize wechat development

    C# Realize the prelude of wechat development I don't want to talk nonsense , Write directly ! Because it's for me to write essays , So don't spray when the gods see it …… 1. There must be a wechat public account 2. You can also apply for testing micro signals , Link to you   http://mp.weixin.qq.co ...

  6. turn : Wechat development to get examples of geographical location (java, Very detailed , Project source code attached )

    Wechat development to get examples of geographical location (java, Very detailed , Project source code attached )   Before this blog , The blogger has written 4 This article is about wechat , Three of them are the basis of this paper : 1. Introduction to wechat development , This article explains in detail the enterprise experience number free application and one ...

  7. turn : The use of wechat development java Get a signature signature( Paste source code , Attached project )

    The use of wechat development java Get a signature signature( Paste source code , Attached project ) label :  WeChat signature Get a signature 2015-12-29 22:15 6954 Human reading   Comment on (3)  Collection   report   classification : WeChat development ...

  8. Java Enterprise wechat development _03_ Address book synchronization

    One . Main points of this section 1. Get the address book key Access method : Log in to enterprise wechat —> Management tools —> Address book synchronization assistant —> Turn on “API Interface synchronization ”  ; After opening , You can see the address book key , You can also set the address book API Authority : Read ...

  9. Java Enterprise wechat development _05_ Message push send message ( Take the initiative )

    One . Main points of this section 1. Sending messages and passive reply messages (1) The process is different : Sending messages means that the third-party server actively informs the wechat server to send messages to users . And the passive reply message is After the user sends the message , Wechat servers deliver messages to Third party servers , Third party servers connect to ...

Random recommendation

  1. Android Happy Snake game practical project development tutorial -02 Virtual arrow keys ( One ) Overview of custom controls

    Overview and contents of the series :http://www.cnblogs.com/chengyujia/p/5787111.html One . Introduction to custom controls In this project , Whether it's the main area of the game or the virtual direction key, it's all through custom controls ...

  2. 【php Study 】PHP Chapter 2 Notes

    Answer questions : 1. By default ,Apache The configuration file name of the server .MySQL The configuration file name of the server and PHP What are the preprocessor configuration file names ?Apache Default master profile : The root directory config Under the folder httpd.co ...

  3. ASP.NET Error handling after deleting database files

    Developing asp.net mvc The program , By default, we use LocalDB, We sometimes think it's deleted App_Data Directory can automatically create a new database , But after we restart the website ( Get into Account) You will find the following error : ...

  4. hdu 2177( Wizov game )

    The question : Easy to understand , On the basis of the weizov game, a new requirement has been added : That is, if you win , Output the first step . analysis : Use violent judgment , See the code for details . Code : #include<stdio.h> #includ ...

  5. DevExpress navBarControl and xtraTabbedMdiManager Achieve browser tab effect

    One :navBarControl Property settings In the toolbox Navigation & Layout Tab NavBarControl, Drag onto the form Add... To the toolbox 2 individual imageCollection. branch ...

  6. Swift - 07 - Boolean type

    //: Playground - noun: a place where people can play import UIKit var str = "Hello, playground& ...

  7. 【 turn 】 The prime number algorithm N Kind of realm

    Original address :http://blog.csdn.net/program_think/article/details/7032600/ * Introduction The day before yesterday , I'm here < My recruitment experience [4]: What can you tell by the written test ?& ...

  8. iptables log The logging function extends the application :iptables Automatically configure temporary access policies , Any public network login server

    One . Modify logging : 1. Modify the configuration file : vi /etc/rsyslog.conf Add the following #iptables log kern.=notice /var/log/iptables.log 2. ...

  9. nginx As a load balancing server ,tomcat As an application server

    1 If you want to use a mainframe , Be able to deploy multiple sites , And access to each site is required in 80 port , May adopt nginx+tomcat The way It should be noted that ,tomcat Make sure you don't listen 80 port .   Static resources can be configured in nginx ...

  10. Tmk Eat soup and rice

    problem : Tmk Eat soup and rice The time limit : 1 Sec   Memory limit : 128 MB Title Description Tmk I like soup and rice ! Tmk I like soup and rice !! Tmk I like soup and rice !!! The soup and rice window is divided into two windows: ordering and taking , A broomcorn is in charge of the order window ...