时间:2021-07-01 10:21:17 帮助过:3人阅读
['a' => 11,'b'=>1],
['a' => 11,'b'=>2],
['a' => 22,'b'=>3],
['a' => 22,'b'=>4],
['a' => 33,'b'=>5],
['a' => 33,'b'=>6],
['a' => 44,'b'=>7],
['a' => 44,'b'=>8],
['a' => 44,'b'=>9],
['a' => 55,'b'=>10],
['a' => 55,'b'=>11],
['a' => 66,'b'=>12],
['a' => 66,'b'=>13],
];
比较二维数组的a键
去掉重复的。获取
$a = [
['a' => 11,'b'=>1],
['a' => 22,'b'=>3],
['a' => 33,'b'=>5],
['a' => 44,'b'=>7],
['a' => 55,'b'=>10],
['a' => 66,'b'=>12],
];
$a = [
['a' => 11,'b'=>1],
['a' => 11,'b'=>2],
['a' => 22,'b'=>3],
['a' => 22,'b'=>4],
['a' => 33,'b'=>5],
['a' => 33,'b'=>6],
['a' => 44,'b'=>7],
['a' => 44,'b'=>8],
['a' => 44,'b'=>9],
['a' => 55,'b'=>10],
['a' => 55,'b'=>11],
['a' => 66,'b'=>12],
['a' => 66,'b'=>13],
];
比较二维数组的a键
去掉重复的。获取
$a = [
['a' => 11,'b'=>1],
['a' => 22,'b'=>3],
['a' => 33,'b'=>5],
['a' => 44,'b'=>7],
['a' => 55,'b'=>10],
['a' => 66,'b'=>12],
];
哦自己找到答案了,求效率更好的方法
function assoc_unique(&$arr, $key)
{
$rAr=array();
for($i=0;$i