function unique_array($array) {
$temp = array();
foreach ($array as $key => $value) {
$temp[$key] = implode(',', $value);
}
$temp = array_unique($temp);
$result = array();
foreach ($temp as $key => $value) {
$result[$key] = explode(',', $value);
}
return $result;
}
$students = array(
array('id' => 1, 'name' => '张三', 'age' => 18),
array('id' => 2, 'name' => '李四', 'age' => 19),
array('id' => 3, 'name' => '王五', 'age' => 20),
array('id' => 4, 'name' => '张三', 'age' => 18)
);
$result = unique_array($students);
print_r($result);
以上是编程学习网小编为您介绍的“php语法怎么实现二维数组去重”的全面内容,想了解更多关于
php入门 内容,请继续关注编程基础学习网。