Delete the php code of repeated values in the array. When $ intTotal is relatively small, for example, the value of $ intRand within 1000 basically does not affect the result, and the execution time of both is similar. When the value of $ intTotal
To remove duplicate values from an array, you can use the foreach method or the array_unique method. the following code uses both methods.
Copy codeThe code is as follows:
$ ArrF = array ();
$ ArrS = array ();
$ IntTotal = 100;
$ IntRand = 10;
For (
In PHP I would like to introduce two more commonly used array filter function Array_filter and Array_unique, one is to filter the array null, one is to filter the array of duplicate values, we now look together.
GrammarArray_filter
In the case of small $inttotal, for example, within 1000, the value of $intRand basically does not affect the results, the two execution time is similar.
When the test $inttotal is greater than 10000, the efficiency of using array_unique is higher
PHP Two methods to remove duplicate values of the array, using the Foreach method and the Array_unique method respectively.Remove duplicate values from an array, you can use the Foreach method, or you can use the Array_unique method.PHP$arrF=Array();
To remove duplicate values from an array, you can use the foreach method or the array_unique method. the following code uses both methods.
The code is as follows:
$ ArrF = array ();
$ ArrS = array ();
$ IntTotal = 100;
$ IntRand = 10;
For ($ I = 0;
In php, I will introduce two commonly used array filter functions, array_filter and array_unique. one is to filter array null values and the other is to filter array repeated values. let's take a look
In php, I will introduce two commonly used array
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.