Statistical frequency of the occurrence of array elements
The Array_count_values () function returns an array containing the associated key/value pairs. In the form of Z
Array array_count_values (array array)
Each of these keys represents a value in Input_array, and the corresponding value indicates that the key appears in Input_array (as a value)
The frequency. Examples are as follows:
$states = Array ("Ohio", "Iowa", "Arizona", "Iowa", "Ohio");
$stateFrequency = Array_count_values ($states);
Print_r ($stateFrequency);
This will return:
Array ([Ohio] = 2 [Iowa] = 2 [Arizona] + 1)
Determining unique array elements
The Array_uniqueo function removes all duplicate values in the array and returns an array of unique values. The form is:
Array array_unique (array array)
Examples are as follows:
$states = Array ("Ohio", "Iowa", "Arizona", "Iowa Gate" Ohio ");
$uniqueStates = Array_unique ($states);
Print_r ($uniqueStates);
This will return:
Array ([0] = Ohio [1] = Iowa [2] = Arizona)
"To the fishing" detailed tutorial See "PHP and MySQL program design," The 92nd page, OK Bookstore (www.okpdf.com) to provide free ebook: Click to download
650) this.width=650; "src=" Http://www.okpdf.com/attachment/1407/thread/3_1_f0f2fd7ffe57c75.png "width=" 384 "height = "516" alt= "3_1_f0f2fd7ffe57c75.png"/>