Algorithm advice, experts come in to help solve the problem
Source: Internet
Author: User
An array $ array [$ I] is provided by experts. if the values include, 3, 5, and 1, 5 ......... I want it to be classified and repeated. The final result is 1, 2, 3, 4, 5 ......... what should I do ?, Array_uniq algorithm for advice. experts come in to help
There is an array $ array [$ I]. if there are such values as, 3, 5, 1, 5 .........
I want it to be classified and repeated. The final result is 1, 2, 3, 4, 5 .........
What should I do?
Array_unique -- Remove repeated values from the array
Description
Array array_unique (array)
Array_unique () accepts array as input and returns a new array without repeated values.
Note that the key name remains unchanged. Array_unique () first sorts the values as strings, then retains only the first key name that is encountered for each value, and then ignores all the key names that follow. This does not mean that the first key name that appears for the same value in the unordered array will be retained.
Note: when and only when (string) $ elem1 = (string) $ elem2, the two units are considered the same. That is, when the expression of a string is the same.
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.