以数字开头的重复数据如:
Array (
[0] => 100
[k1] => 100
[1] => 2123
[k2] => 2123 )
该方法可以将以数字为key的值去掉,先将数组按照key倒序排序,然后用array_unique的方法将重复的值去掉。
不能适用于下面的情况:不同的key值存在相同的value的情况
function array_unique_value($arr = array()){
array_multisort($arr, SORT_DESC, array_keys($arr));
print_r(array_unique($arr));
}
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