This article introduces the contents of the PHP built-in method of the array, has a certain reference value, now share to everyone, the need for friends can refer to
Array Chapter
PHP 5 Array function
Function description
function
Array ([key =>] value, [key =>] value, [key =>] value, [key =>] value)//key can be an integer or string//value can be Is any value
Array_change_key_case--Returns an array with string key names all lowercase or uppercase
Array_chunk--Splitting an
One, custom function
Custom functions are our own defined functions, and the Custom function format in PHP is as follows:
function Funname (arg1, arg2, Arg3 ...) {//todoreturn values;}
Output Result:Here's another variable parameter function.
";
Share an instance code of a PHP array sort, including a forward sort, reverse sort, natural sort, with the reference of a friend in need.
PHP array sorting, code sharing.As follows: $data) {$refer [$i] = & $data [$field]; Switch
We often run into a sort of a key value based on a two-dimensional array, and then suddenly think of a function in the Onethink project, which is then drawn out as a reference.2014-05-22 17::15 Read the comments of enthusiastic phper to add the
This article to share the content is about the PHP array sorting function, has a certain reference value, the need for friends can refer to.
function, you u can customize the comparison function; Yes k , sort by key; there is r (reverse),
Reading an array
$arr =array ("xx" = "fork", "yy" = "crooked");
echo "reads the first:". $arr [Number of xx];//statistics array
$array =array (AAA,BBB,CCC,DDD);
echo "Number of arrays:". Count ($array). " n "; Computes the number of array cells or
Php Tutorial array Overview and array functionsThe array function allows you to operate on arrays.Php supports single-dimension and multi-dimensional arrays. At the same time, the database query results are provided to construct an array
PHP two-dimensional array sorting function, the default natural sort, that is sort. Here you can specify a number of methods to sort by a value in a two-dimensional array, depending on the program note below.
Copy CodeThe code is as follows:
/**
* @
PHP strnatcmp () function "Natural Sorting algorithm" for string comparison usage analysis (contrast strcmp function), strnatcmpstrcmp
This example describes the use of the STRNATCMP () function "Natural sorting algorithm" in PHP for string
/**
* Rewind the internal pointer of the array back to a
* @param array & $arr
* @return Mixed returns the value of the previous cell and returns FALSE when there are no more cells
* If the array contains empty cells, or if the value of the cell is 0
PHP Array function classification, Phparray function
basic functions of array manipulation1, the key name and value of the arrayArray_values ($arr); Get the value of an arrayArray_keys ($arr); Get the key name of the arrayArray_flip ($arr); The
PHP Array,phparray
Function
Describe
Array ()
Creates an array.
Array_change_key_case ()
Returns an array whose keys are uppercase or lowercase.
Array_chunk ()
Splits an array into a new
Recently just internship, often used in the array of PHP, so summarize, not at any time to random search.First: basic knowledgePHP supports numeric indexed arrays and associative arrays, and associative arrays allow more meaningful data, such as
The set interface in Java has the following characteristics:
Duplicate elements are not allowed;
The position of the elements in the collection is not sequential;
An element with and only one value of NULL.
Because the set
1. Container class DiagramThe dashed box represents the interface.A solid Line box represents an entity class.A thick wireframe represents the most frequently used entity class.The arrow of the dot line indicates that the interface is implemented.A
Basic functions of array manipulationThe key name and value of the arrayArray_values ($arr); Get the value of an arrayArray_keys ($arr); Get the key name of the arrayArray_flip ($arr); The values in the array are interchanged with the key names (if
/* "Array function" *///statistical calculationCount counts the number of cells in an array or the number of properties in an objectArray_count_values the number of occurrences of all values in the statistics arrayArray_product computes the product
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.