Repeating data starting with a number such as:
Copy code The code is as follows:
Array (
[0 ] => 100
[k1] => 100
[1] => 2123
[k2] => 2123 )
This method can be used as To remove the values whose numbers are keys, first sort the array in reverse order by key, and then use the array_unique method to remove duplicate values.
It cannot be applied to the following situations: different key values have the same value
Copy code The code is as follows:
function array_unique_value($arr = array()){
array_multisort($arr , SORT_DESC, array_keys($arr));
print_r(array_unique($arr));
}
http://www.bkjia.com/PHPjc/736858.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/736858.htmlTechArticleRepeating data starting with a number such as: Copy code The code is as follows: Array ( [0] = 100 [k1] = 100 [1] = 2123 [k2] = 2123 ) This method can remove the value with a number as the key. First, convert the array according to...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn