我有一个问题,我在下面有这个结果,我想删除相同的时间戳。删除阵列中的冗余数据
示例结果:
Array
(
[0] => [1341100800000, 0]
[1] => [1341100800000,85]
[2] => [1343779200000,54]
[3] => [1343779200000, 0]
)
期待输出
Array
(
[0] => [1341100800000,85]
[1] => [1343779200000,54]
)
我想使用然后爆炸SUBSTR函数来获取价值。这里是我想出了迄今为止..
$explode = array();
foreach($string_format as $key => $value) {
$explode[] = explode(',', substr($value, 1));
if((isset($explode[0]) && $explode[0][0] == $explode[1][0])) {
unset($explode[0]);
}
//print_r($explode);
}
发生了什么事的第二个值(0,85,0和54)?如果还有其他值,例如:0,85和95,该怎么办? – ariefbayu
您的问题不完整。你如何选择要保留的重复值? –