我怎样才能从同一数组中获得共同的价值 [英] How can i get the common value from same array

查看:42
本文介绍了我怎样才能从同一数组中获得共同的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从同一数组中获取公共值和不同值

I want to get the common value as well as different value from same array

例如:

$array1 = array(1,2,2,2,3,3,4,4,4,5,5,5,5,6,6,6,7,8,9,10);

我希望数组为

$array1 = array(1,2,3,4,5,6,7,8,9,10);

任何人都可以给我这个想法来带来这样的数组

Can anyone give me the idea to bring the array like this

推荐答案

为什么不尝试

$array1 = array(1,2,2,2,3,3,4,4,4,5,5,5,5,6,6,6,7,8,9,10); 
$array1 = array_unique($array1);

http://php.net/manual/en/function.array-unique.php

这篇关于我怎样才能从同一数组中获得共同的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆